Quantcast
Channel: Angular2 - should private variables be accessible in the template? - Stack Overflow
Viewing all articles
Browse latest Browse all 9

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

$
0
0

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 all articles
Browse latest Browse all 9

Latest Images

Trending Articles



Latest Images