I am willing to show/hide a Loading message once the async call from a REST API finishes, it hides the Loading message and show the fetched content instead.
I don't know how to achieve that in Angular2, but in JavaScript, something like this is done:
<h2 id="message">Loading....</h2>
<script>
$(document).ready(function(){
$('#message').hide();
//Then Show the newly fetched content
}
</script>
I believe you are using an ngFor to display the data fetched.
This should work for you:
<div *ngIf="!content">Loading...</div>
<div #ngFor="#content of content"></div>
<div *ngIf="content">Now the fetched content appears here!</div>
<div *ngIf="!content">Loading...</div>
<div *ngIf="content"> TODO display the content here </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.