Angular 2 – how to update model

I receive data model using a service:

  return this.http.get(queryUrl, opts)   .map((response: Response) => {
    return (<any>response.json()) => {
      return new User({
        name :

This gets accesed from component

      makeRequest() {
          this.result = this.myService.loadData()

And passed down as result: Observable<User[]>; to a form, this on Submit sends a post request which gets saved to the backend,all this works. The problem is that my model/website doesn’t get updated this way.

Probably it’s a silly question but, how do I update my model (now after saving to backend the app still holds the old data)? What ar the strategies? Do I have to pass updated data object back to top component and then update?

Source: stackoverflow-javascript

Leave a Reply

Your email address will not be published. Required fields are marked *