【发布时间】:2017-01-26 13:48:18
【问题描述】:
我知道在 ng2 中我们有 ComponentFactoryResolver 可以解析工厂,我们可以申请 ViewContainerRef。
但是,指令有类似的东西吗?一种实例化它们并将它们应用于组件的投影内容的方法?
【问题讨论】:
-
这个我其实不知道,但是看到指令和组件非常相似,使用组件工厂对指令不起作用吗?
-
它不起作用,它必须添加到模块的entryComponents(因为,entryComponents对于Directive装饰器不存在),它不喜欢它。
标签: angular projection angular-directive angular2-template