【问题标题】:While downgrade component, the @ContentChild(TemplateRef) is undefined降级组件时,@ContentChild(TemplateRef) 未定义
【发布时间】:2017-05-06 08:02:24
【问题描述】:

在任何组件中使用它:

@ContentChild(TemplateRef) public myTemplate: TemplateRef<any>;

这将在角度 2 中工作,我可以阅读

this.myTemplate

但是在将组件降级后可以在 AngularJS 1.6.2 中工作而不是

this.myTemplate // undefined

降级时有什么需要做的吗?也许可以添加到我的构造函数中?

【问题讨论】:

  • 但是降级后..你用的是哪个版本?
  • angularJS 1.6.2
  • Angular 2.4.8 如果这很重要

标签: angularjs angular typescript angular2-components


【解决方案1】:

没有办法让它与降级的角度组件一起工作。参考这个帖子:https://github.com/angular/angular/issues/16611

【讨论】:

    猜你喜欢
    • 2017-01-28
    • 2017-09-02
    • 2017-12-09
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    • 2020-06-10
    • 2017-02-07
    • 2019-09-05
    相关资源
    最近更新 更多