AoT NGC / Angular2: the property is protected and available only in the Error class

In our components of our Angular 2 / Ionic 2 project (final / rc0), I use:

protected contentTarget: ViewContainerRef;

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

AoT compiler says:

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

A variable (property) is not used anywhere in the whole project.

So ... can anyone shed some light on this, is createComponent factory passing the contentTarget variable to its child element, or why the compiler doesn't like to defend itself here? Are variables β€œforbidden” protected in all Angular2?

+4
source share
1 answer

From here

(, ) . , TS . 2 -.

, contentTarget , , AOT.

+7

Source: https://habr.com/ru/post/1657610/


All Articles