Javascript 注入大部分html时Angular2中的微调器
在我的Angular应用程序中,我有一个开关,可以将大量html数据注入页面。注入大约需要1-2秒,我想知道是否可以实现一个微调器,让用户知道视图正在渲染 我很少看到基于typescript代码的实现,但没有一个适合我的情况。 如果可能的话,我只想考虑一下Javascript 注入大部分html时Angular2中的微调器,javascript,angular,Javascript,Angular,在我的Angular应用程序中,我有一个开关,可以将大量html数据注入页面。注入大约需要1-2秒,我想知道是否可以实现一个微调器,让用户知道视图正在渲染 我很少看到基于typescript代码的实现,但没有一个适合我的情况。 如果可能的话,我只想考虑一下 <table (click)="switch.active=!switch.active"> <tr *ngFor="condition"></tr> //here I have about 500 row
<table (click)="switch.active=!switch.active">
<tr *ngFor="condition"></tr> //here I have about 500 rows
</table>
//这里我有大约500行
您可以使用或ng hide获得渴望效果。根据通过js部件加载数据的时间,将条件设置为true。我不知道您是如何获取数据的,但您可以在那里设置一个条件,以查看何时完成,然后更新ng show条件,直到数据id加载显示微调器
您还可以尝试为每一行放置加载器,以便用户可以看到数据,即使数据未完全加载
<table (click)="switch.active=!switch.active">
<div class="spinner" ng-show="true condition till data is loading">
</div>
<tr *ngFor="condition" ng-show="(negate false) condition when loading complete"></tr>
</table>
它们在angular 2及以上版本中可用吗?您使用的是哪种angular 5版本