TSLint - 您只能绑定到公共类成员(templates-use-public)

时间:2017-01-12 20:12:45

标签: angular typescript webstorm tslint

我对此规则(templates-use-public)和WebStorm有些麻烦。你可以在这里看到它:

enter image description here

这条规则的主要目的是什么?怎么了?

1 个答案:

答案 0 :(得分:6)

此规则是关于从模板访问组件的私有成员。私人成员仅用于课堂本身;模板在组件范围之外执行,因此它们不应该访问私有模块。请参阅https://groups.google.com/forum/#!msg/angular/D_O_1fqA9WQ/pRNQARRiBgAJhttps://github.com/devoto13/angular2-private-members-example

对于突出显示,似乎codelizer报告了错误的错误位置。请使用ng lint在终端中运行tslint - 结果是什么?