[Angular] Show a loading indicator in Angular using *ngIf/else, the as keyword and the async pipe
2024-08-26 02:49:27
The network may be unreliable and loading data may take time. Thus it is important to give the user some feedback about what's going on as fast as possible. In this lesson we learn how to leverage the else
block of the *ngIf
directive to show a simple loading indicator.
<div *ngIf="buttonClicked">
<div *ngIf="person$ | async as person; else personLoading">
Name: {{ person.name }} <br />
Twitter: {{ person.twitter }}
</div>
<ng-template #personLoading>
Loading person...
</ng-template>
</div>
最新文章
- RDIFramework.NET平台代码生成器V3.1版本全新发布-更新于2016-10-29(提供下载)
- 9.1 js基础总结2
- iOS 阶段学习第八天笔记(指针)
- paper 75:使用MATLAB的神经网络工具箱创建神经网络
- C++:概述
- Javascript高级程序设计读书笔记(第二章)
- Android ImageView(scaleType属性)图片按比例缩放
- winform在鼠标操作时要判断是否按下Ctrl键
- PAT乙级1065 map
- (转)Spring Boot(十二):Spring Boot 如何测试打包部署
- spark获取时间
- SpringMVC @RequestBody的使用
- 第16月第6天 vs2005 lseek directdraw
- linux每日命令(17):which命令
- java web 方面
- img 标签
- Python中对矩阵的洗牌操作
- Java web中WEB-INF目录理解
- MongoDB删除文档
- spring.net 在demo中的分析