This is because the html-related value must be evaluated every time something โchangesโ in the application, so if the value of the linked element has changed, it will be reflected in html, which will give you this magical autoupdating binding. This is probably what you want 90% of the time, since you don't want to worry about notifying angular to update the value of the associated property.
If you have some kind of heavy logic in getter or you want to control when the value will be updated, you can change the changeDetectionStrategy components to onPush, for example, in this plunger .
@Component({ selector: 'my-app', template: ` <div><button (click)="_service.ShowItem()">Show Item</button></div> <div>{{_service.Item}}</div> `, providers: [ Service ], changeDetection: ChangeDetectionStrategy.OnPush })
There is a great explanation on how angular2 works with thoughtram change detection
This is similar to saying: "Do not check this component when changes are detected, I will let you know when to check it."
Then you can use a service called ChangeDetectorRef to mark the component for change detection.
For http, what you want to do is have a trigger to make an http call, and then get the desired value from the response and "cache" it somewhere so that you can bind it to the user interface. The trigger can be varied, depending on your case, for example. interval, recursion, button, etc.
source share