简体   繁体   English

打字稿组件选择器应命名为undefined

[英]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"],

here the reference to this config property. 这里是对该配置属性的引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 避免出现错误“组件的选择器应命名为kebab-case并包含破折号” - Avoid error 'The selector of the component should be named kebab-case and include dash ' 组件“ AppFooterComponent”的选择器应用作元素 - The selector of the component “AppFooterComponent” should be used as element 使用TypeScript的Angular组件中的未定义服务 - Undefined service in Angular component using TypeScript 我应该将类属性添加到Angular组件选择器标签中吗 - Should I add class attributes to Angular component selector tags route.queryParams.subscribe 在 Angular Typescript 组件中返回 undefined - route.queryParams.subscribe returns undefined in Angular Typescript Component 开发有角度的4组件时是否应包括打字稿库lib设置dom? - Should the typescript lib setting dom be included when developing an angular 4 component? (角度升级)AngularJS 组件的绑定应该是未定义的 - (Angular upgrade) AngularJS component's binding should be undefined Angular 7,组件选择器+ html选择器 - Angular 7, component selector + html selector Jasmine 它(“应该创建”)失败,组件应该创建失败类型错误:无法读取未定义的属性“下一个” - Jasmine it('should create') fails with Component should create FAILED TypeError: Cannot read property 'next' of undefined NgRx 选择器返回未定义 - NgRx selector returns undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM