Angular 6 / tr 元素的 TSLint 组件选择器
Angular 6 / TSLint Component Selector for tr element
在早期版本中,我能够将组件选择器指定为属性。
@Component({
selector: '[app-row]',
...
})
export class RowComponent implements OnInit {
ngOnInit() {}
}
HTML:
<tr app-row></tr>
现在我得到 lint 错误:
错误:/path/to/row.component.ts[8, 13]:组件 "RowComponent" 的选择器应用作元素 (https://angular.io/styleguide#style-05-03)
我知道我可以在元素中嵌套 tr,但我并不总是能控制样式,而且我个人不喜欢不必要的嵌套,通常会尝试避免它。
如果我应该始终使用元素选择器,如何将组件指定为 "tr" 元素。即:<app-row></app-row>
?什么是合适的 Angular 6 方法来完成这个?
注意:我已经查看了样式指南的 link,该部分未涵盖任何与我的特定用例类似的内容。我也试过按 id 选择,但得到了同样的 lint 错误。
我更新了 tslint.json 以允许组件选择器成为一个属性。
"component-selector": [
true,
["element", "attribute"],
"app",
"kebab-case"
],
在早期版本中,我能够将组件选择器指定为属性。
@Component({
selector: '[app-row]',
...
})
export class RowComponent implements OnInit {
ngOnInit() {}
}
HTML:
<tr app-row></tr>
现在我得到 lint 错误:
错误:/path/to/row.component.ts[8, 13]:组件 "RowComponent" 的选择器应用作元素 (https://angular.io/styleguide#style-05-03)
我知道我可以在元素中嵌套 tr,但我并不总是能控制样式,而且我个人不喜欢不必要的嵌套,通常会尝试避免它。
如果我应该始终使用元素选择器,如何将组件指定为 "tr" 元素。即:<app-row></app-row>
?什么是合适的 Angular 6 方法来完成这个?
注意:我已经查看了样式指南的 link,该部分未涵盖任何与我的特定用例类似的内容。我也试过按 id 选择,但得到了同样的 lint 错误。
我更新了 tslint.json 以允许组件选择器成为一个属性。
"component-selector": [
true,
["element", "attribute"],
"app",
"kebab-case"
],