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

Answer by Cosmin Popescu for Angular2 - should private variables be...

I know that this is a little late, but I've been preocuppied with this problem even since Angular2 and finally I've come up with a nice workaround to allow me to have nice proper components API's and...

View Article



Answer by Khushbu Suryavanshi for Angular2 - should private variables be...

In tsconfig.app.json if you provide the 'fullTemplateTypeCheck' option in compiler options you can see all the invalid references in html files of your project at the time of project...

View Article

Answer by Ivens Applyrs for Angular2 - should private variables be accessible...

The short answer is no you should not be able to access private members from the template because it is technically separated from the TS file.

View Article

Answer by Franklin Pious for Angular2 - should private variables be...

A workaround could be using private variables in ts file and using getters.private _userName = "Test Name";get userName() { return this._userName;}This is a good approach because the ts file and the...

View Article

Answer by anusreemn for Angular2 - should private variables be accessible in...

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-setterA...

View Article


Answer by Yaroslav Admin for Angular2 - should private variables be...

UPDSince Angular 14, it is possible to bind protected components members in the template. This should partially address the concern of exposing internal state (which should only be accessible to the...

View Article

Answer by Günter Zöchbauer for Angular2 - should private variables be...

Even though the code example indicates the question is about TypeScript it doesn't have the typescript tag. Angular2 is also available for Dart and this is a notable difference to Dart.In Dart the...

View Article

Answer by drew moore for Angular2 - should private variables be accessible in...

Edit: This answer is now incorrect. There was no official guidance on the topic when I posted it, but as explained in @Yaroslov's (excellent, and correct) answer, this is no longer the case: Codelizer...

View Article


Angular2 - should private variables be accessible in the template?

If a variable is declared private on a component class, should I be able to access it in the template of that component?@Component({ selector: 'my-app', template:...

View Article

Browsing all 9 articles
Browse latest View live




Latest Images