Property 'X' is private and only accessible within class 'xyzComponent'

前端 未结 7 1238
逝去的感伤
逝去的感伤 2020-12-07 13:48

I\'m trying to build angular2 application for production for that I\'m following this blog. After my ngc successful compilation when the

7条回答
  •  爱一瞬间的悲伤
    2020-12-07 14:22

    For a given component all its members (methods, properties) accessed by its template must be public in the AOT 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.

    In short: you can't access private members in your templates if you want to use ahead-of-time compilation.

    For better explaination https://github.com/angular/angular/issues/11422

提交回复
热议问题