#How To Update HTML Component After PUT API Call?

17 messages ยท Page 1 of 1 (latest)

glad hill
#

Hi, I have an array that I loop through in my HTML component.
When a button is pressed, a PUT API call is triggered.
After the API call, the array values should change and the website needs to update.

E.g. looping through 10 products and then deleting 1, then the website needs to reflect those changes. What do I need for that? I thought ngOnChange but that is only for parent & child relationships.

#

I tried: .subscribe(() => this.ngOnInit()); but not effect.

left narwhalBOT
#

@brave ledge, you can use the following snippet to have your code formatted and colored by Discord. Replace ts with the language you need (i.e. html, js, css, etc)
```ts
// your code goes here
```

glad hill
#

that's totally fine. I will check these out in a bit and read up on them. Thanks a bunch so far ๐Ÿ˜„
I gotta fix some bug first before I can test this out

glad hill
#

Fixed it btw.

brave ledge
#

Hopefully using the AsyncPipe, or I'd consider it not really fixed ๐Ÿ™‚

peak meteor
peak meteor
glad hill
peak meteor
#

True so you did it with subscribe and next right

glad hill
#

subscribe(() => this.myArray = newValueOfMyArray) something like this