无法确定location / x.component.ts中的模块类x Component将x组件添加到Ng Module中以对其进行修复。角度4

时间:2019-03-27 11:22:51

标签: angular

它显示错误:

  

无法在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

1 个答案:

答案 0 :(得分:0)

通过更改此方法解决了该问题-

在aslaURLActionComponent组件中:-

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

在Ng模块中:-

@NgModule({     声明:[         PagesComponent,         ActionComponent,         ActionURLComponent,         CCURLActionComponent,        aslaURLActionComponent    ] })