![](/img/trans.png)
[英]Angular 7 - Production Build Error - Cannot determine the module for class X Component! Add X Component to the NgModule to fix it
[英]Can not determine the module class x Component in location/x.component.ts add x component to Ng Module to fix it. Angular 4
它显示错误:
无法在C中确定CCURLActionComponent类的模块:/Users/HP/Desktop/default-2/default/src/app/content/pages/header/action/aslaAction/aslaActionURL/asla-url-action.component.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
通过改变这个来解决问题 -
在aslaURLActionComponent组件中: -
@Injectable()导出类aslaURLActionComponent扩展CCURLActionComponent实现OnInit {}
在Ng模块中: -
@NgModule({declarations:[PagesComponent,ActionComponent,ActionURLComponent,CCURLActionComponent,aslaURLActionComponent]})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.