Tuesday, February 28, 2017

Angular 2 - Binding a promise directly to a view using AsyncPipe

Angular 2 goes reactive all the way. This means that data you get back from the http service is exposed through an observable.

But how can you show the observable data on the screen? One option is to subscribe to the observable, extract the result, map it to a property on your component and databind to this property on your view. However there are better alternatives out there…

Probably the cleanest solution is the use of the AsyncPipe.

The main benefit to utilizing the async pipe is the performance optimization and one way data flow patterns that this feature can help enable.

2 comments:

Akshaysri said...

I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.
PTE Coaching in Chennai

Asharaf said...

Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much

Self Employment Tax
Tax Preparation Services
Tax Accountant
Tax Consultant
Tax Advisor