Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 typescript protected members in component templates

I was thinking about how could be possible implement some members in a component that could be accessed from the template but not from a parent component.

I searched for some information about the typescript visibility in angular 2 but I only found topics about "public" and "private" declarations but not about"protected".

So, does it make sense to use "protected" for this?

like image 394
Sokka Avatar asked Mar 08 '17 17:03

Sokka


1 Answers

the compiler warns me if i use in the html file a property which is declared private (although it works!). If i use protected, then no warns is emitted

like image 160
Andrea Scarafoni Avatar answered Oct 13 '22 02:10

Andrea Scarafoni