I'm new to AngularJS 2.0, basically I'm loading data through Promise in constructor, but the template is rendered before the promise is resolved.
Any idea how to achieve this?
Thanks, M.
I'm new to AngularJS 2.0, basically I'm loading data through Promise in constructor, but the template is rendered before the promise is resolved.
Any idea how to achieve this?
Thanks, M.
You can test the data
before using it.
<ul *ngIf="data">
<li *ngFor="let item of data">{{item.value}}</li>
</ul>
false
value that says if the content is loaded or not. Something like isDataLoaded
. Then, after content loads, set it to true
–
Souza © 2022 - 2024 — McMap. All rights reserved.