Hi Sander,
I'm using similar structure as angular.io and not to say there are other
way accomplish this but looking at your example am i to understand that in
order to shrink the code i have I should move the function subscrib
function in the service.ts instead of component.ts?
On Tuesday, December 13, 2016 at 11:10:44 PM UTC-5, Sander Elias wrote:
>
> Hi Dawg,
>
> Yes, this can by much simpler when you use the async pipe in your template.
> Controller:
> this.projectListFromD = this._getPopulateDropDownList.getProjectListMethod
> ()
> this.projectTaskFromDB = this._getPopulateDropDownList.
> getProjectTaskMethod()
>
> in your template, something like:
> <ul>
> <li ngFor="let item of projectListFromDB |async">{{item.name}}</li>
> <ul>
>
> error display: (this is syntax from the NEXT angular version that gets
> rolled out! Does not work in current versions!)
> <div *ngIf="projectListFromDB | async; else loading; let list">
> <span ngIf="list.length === 0">Sorry, we failed stage 1</span>
> </div>
> <template #loading>Loading data from DB...</template>
>
> Hope this helps you a bit.
>
> Regards
> Sander
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.