Angular 2使用ViewContainerRef和NgIf显示对话框

时间:2017-05-12 06:43:18

标签: angular

许多教程展示了我们如何使用ViewContainerRef动态插入组件来实现窗口小部件,如对话框弹出窗口。 (例如https://www.lucidchart.com/techblog/2016/07/19/building-angular-2-components-on-the-fly-a-dialog-box-example/

我想知道仅使用* ngIf有什么好处? 我可以:

<my-dialog-component *ngIf="someFlagControlledByAService"></my-dialog-component>

可以保存很多行代码

非常感谢!

0 个答案:

没有答案
相关问题