【发布时间】:2018-07-17 16:01:20
【问题描述】:
我正在尝试创建一个带有属性作为选择器的组件,如下所示:
@Component({
selector: '[my-attribute-selector]',
template: ``
})
export class MyComponent {
// Some cool stuff
}
但是,tslint 对此进行了抱怨,并带有以下消息:
[tslint] The selector of the component "MyComponent" should be used as element
我知道我可以禁用该 tslint 规则,但我想知道在这样做之前是否有合理的理由不应该使用属性作为组件的选择器。
提前致谢!
【问题讨论】: