Quantcast
Viewing latest article 5
Browse Latest Browse All 9

Answer by anusreemn for Angular2 - should private variables be accessible in the template?

Private variables can be using within the template of component. See angular2 cheat-sheet for guide: https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-child-setter

A more detailed explanation on public/private members of classes in typescript can be found here: https://www.typescriptlang.org/docs/handbook/classes.html.

All members by default are Public. Public members can be accessed from outside the component class along with the class-instance. But Private members can be accessed only within the class member functions.


Viewing latest article 5
Browse Latest Browse All 9

Trending Articles