[英]Typescript component selector should be named undefined
In my angular application, I have a component which is referred to by the html of another component, so I gave it a selector in kebab case as follows: 在我的有角度的应用程序中,我有一个组件,该组件由另一个组件的html引用,因此在kebab情况下,给了它一个选择器,如下所示:
@Component({
selector: 'swiftlog-navbar',
templateUrl: './swiftlog-navbar.component.html',
styleUrls: ['./swiftlog-navbar.component.css']
})
export class SwiftlogNavbarComponent {
When I run yarn start I get the following error 运行纱线启动时,出现以下错误
WARNING in ./src/main/webapp/app/swiftlog-navbar/swiftlog-navbar.component.ts [4, 13]: The selector of the component "SwiftlogNavbarComponent" should be named undefined ( https://angular.io/styleguide#style-05-02 )'
[/src/main/webapp/app/swiftlog-navbar/swiftlog-navbar.component.ts [4,13]中的警告:组件“ SwiftlogNavbarComponent”的选择器应命名为undefined( https://angular.io/ styleguide#style-05-02 )'
Any ideas what is meant by "should be named undefined", which rule in the tslint file is being applied here, or what I am doing wrong? 有什么主意是“应该命名为undefined”,tslint文件中的哪个规则正在此处应用,或者我做错了什么? I can't find any clues in the styleguide quoted above.
我在上面引用的样式指南中找不到任何线索。
Thanks, Mart 谢谢,玛特
If you are using angular-cli try to add your own prefix to the angular-cli.json: 如果您正在使用angular-cli,请尝试将自己的前缀添加到angular-cli.json:
apps: [
{ ..., "prefix": "swiftlog"}
]
also change your tslint config: 还更改您的tslint配置:
"component-selector": [true, "element", "swiftlog", "kebab-case"],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.