Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TSLint - You can bind only to public class members (templates-use-public)

I'm having some troubles with this rule (templates-use-public) and WebStorm. You can see it here:

enter image description here

What's the main purpose for this rule? What's wrong?

like image 790
ismaestro Avatar asked Jan 12 '17 20:01

ismaestro


1 Answers

This rule is about accessing component's private members from the template. Private members are intended to be used in a class itself only; templates are executed outside of the component scope, so they shouldn't have access to privates. Please see https://groups.google.com/forum/#!msg/angular/D_O_1fqA9WQ/pRNQARRiBgAJ, https://github.com/devoto13/angular2-private-members-example.

As for highlighting, seems that incorrect errors positions are reported by codelizer. Please run tslint in terminal using ng lint - what is the result?

like image 200
lena Avatar answered Sep 30 '22 20:09

lena