X 归档 2018-10-30
Remember yourself doing loading in #Angular app?
<div *ngIf="model; else loading">
Model
</div>
<ng-template #loading>
<my-loading></my-loading>
</ng-template>
And this code goes in many components. How to keep it DRY?
Angular structural directive to the the rescue!
<div *ngIf="model; else loading">
Model
</div>
<ng-template #loading>
<my-loading></my-loading>
</ng-template>
And this code goes in many components. How to keep it DRY?
Angular structural directive to the the rescue!
还记得在 #Angular 应用里写加载状态的经历吗?
<div *ngIf="model; else loading">
Model
</div>
<ng-template #loading>
<my-loading></my-loading>
</ng-template>
而且这段代码会在很多组件里重复出现。如何保持 DRY?
Angular 结构型指令来救场!
<div *ngIf="model; else loading">
Model
</div>
<ng-template #loading>
<my-loading></my-loading>
</ng-template>
而且这段代码会在很多组件里重复出现。如何保持 DRY?
Angular 结构型指令来救场!


