We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ng-template是一个模板元素,它里面的内容不会渲染,只有其他代码主动调用读取它,它才会显示出来。
ng-template
它一般和结构型指令结合使用,如*ngIf, *ngFor, [ngSwitch]或其他自定义指令。
如果只是像下面这样写不会显示出来。
<ng-template> <p> 这是一块正经的内容 </p> </ng-template>
<p *ngIf="isCat; else isDog"> 小猫 </p> <ng-template #isDog> <p>小狗</p> </ng-template>
一般使用场景是有一段html代码,在某个时刻需要使用到会把它包裹在ng-template中。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ng-template
是什么
ng-template
是一个模板元素,它里面的内容不会渲染,只有其他代码主动调用读取它,它才会显示出来。它一般和结构型指令结合使用,如*ngIf, *ngFor, [ngSwitch]或其他自定义指令。
如果只是像下面这样写不会显示出来。
怎么用
一般使用场景是有一段html代码,在某个时刻需要使用到会把它包裹在
ng-template
中。The text was updated successfully, but these errors were encountered: