【问题标题】:Can not determine the module class x Component in location/x.component.ts add x component to Ng Module to fix it. Angular 4无法确定 location/x.component.ts 中的模块类 x 组件将 x 组件添加到 Ng 模块以修复它。角 4
【发布时间】:2019-03-27 11:22:50
【问题描述】:

显示错误:

无法确定 C:/Users/HP/Desktop/default-2/default/src/app/content/pages/header/action/aslaAction/aslaActionURL/asla-url-action.component 中的类 CCURLActionComponent 的模块。 ts!将 CCURLActionComponent 添加到 NgModule 以修复它。

@Component({
  selector: 'm-action',
  templateUrl: './cc-url-action.component.html',
  providers: [PagesService],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CCURLActionComponent implements OnInit {
  htmlContent = '';
  textAnalyticsInput:any;
  textAnalyticsResponse:any;
  polarity:any;
}

上面的代码对于 ts 文件中的 cc-url-action.component 和 asla-url-action.component 是一样的

在 pages.module.ts 中:

import { CCURLActionComponent } from "./header/action/CCAction/CCActionURL/cc-url-action.component";

@NgModule({
    declarations: [
        PagesComponent,
        ActionComponent,
        ActionURLComponent,
        CCURLActionComponent

【问题讨论】:

    标签: angular


    【解决方案1】:

    通过改变这个解决了问题-

    在 aslaURLActionComponent 组件中:-

    @Injectable() 导出类 aslaURLActionComponent 扩展 CCURLActionComponent 实现 OnInit { }

    在 Ng 模块中:-

    @NgModule({ 声明:[ 页面组件, 动作组件, 动作URL组件, CCURLAction 组件, aslaURLActionComponent ] })

    【讨论】:

      猜你喜欢
      • 2018-10-08
      • 2023-03-09
      • 2018-04-03
      • 2018-04-17
      • 2019-05-20
      • 2010-10-09
      • 2019-05-20
      • 2018-05-15
      • 2017-09-21
      相关资源
      最近更新 更多