AoT NGC / Angular2:属性受到保护,只能在类Error中访问

在我使用的Angular 2 / Ionic 2(final / rc0)项目中的组件中:
protected contentTarget: ViewContainerRef;

ngOnInit() {
        this.contentTarget.createComponent(componentFactory);
    }

AoT编译器说:

Error at ....: Property 'contentTarget' is protected and only accessible within class 'IncludeTemplateComponent' and its subclasses.

变量(属性)不会在整个项目中的任何其他位置使用.

那么……任何人都可以对此有所了解,是createComponent工厂将contentTarget变量传递给它的子节点,或者为什么编译器不喜欢这里受保护?现在所有Angular2中的受保护变量都是“被禁止的”吗?

here

For a given component all its members (methods,properties) accessed
by its template must be public in the ahead-of-time compilation
scenario. This is due to the fact that a template is turned into a TS
class. A generated class and a component are 2 separate classes Now
and you can’t access private members cross-class.

我的看法是,contentTarget由模板引擎使用,因此,AOT必须公开才能工作.

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...