Angular5 tslint错误:The selector of the component “XXXComponent” should be used as element

错误描述

在项目中本身封装了一个 select 组件css

@Component({
    selector: '[app-choosen-select]',
    templateUrl: './selectcommon.component.html',
    styleUrls: ['./style.scss']
})
export class SelectCommonComponent implements OnInit, AfterViewInit, OnDestroy {

ts编译报错。html

解决方案

修改tslint.jsonjson

"component-selector": [
      true,
      "element",
      "app",
      "kebab-case"
    ],

改成app

"component-selector": [
      true,
      ["element","attribute"],
      "app",
      "kebab-case"
    ],

组件引用

<div app-choosen-select [options]="groupOptions" class="cpu-select-round"></div>
相关文章
相关标签/搜索