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
可以抽离成一个组件,也可以使用ngTemplateOutlet来实现共享
ngTemplateOutlet
比如说有一段代码
<div> 第一区域 <p>共享的部分</p> </div> <div> 第二区域 <p>共享的部分</p> </div>
如何将共享的部分抽离出来呢?
<div> 第一区域 <ng-container *ngTemplateOutlet="shared"></ng-container> </div> <div> 第二区域 <ng-container *ngTemplateOutlet="shared"></ng-container> </div> <ng-template #shared> <p>共享的部分</p> </ng-template>
ngTemplateOutlet接收的是一个模板名称,即#shared,可以自定义。如果想传递参数请查看ngTemplateOutlet介绍。
#shared
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一个文件中同一段html被多次用到怎么抽离
可以抽离成一个组件,也可以使用
ngTemplateOutlet
来实现共享比如说有一段代码
如何将共享的部分抽离出来呢?
ngTemplateOutlet接收的是一个模板名称,即
#shared
,可以自定义。如果想传递参数请查看ngTemplateOutlet
介绍。The text was updated successfully, but these errors were encountered: