首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法确定位置/x.Component.ts中的模块类x组件,将x组件添加到Ng模块以修复它。角4

无法确定位置/x.Component.ts中的模块类x组件,将x组件添加到Ng模块以修复它。角4
EN

Stack Overflow用户
提问于 2019-03-27 11:22:50
回答 1查看 48关注 0票数 0

它显示了错误:

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

代码语言:javascript
复制
@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中:

代码语言:javascript
复制
import { CCURLActionComponent } from "./header/action/CCAction/CCActionURL/cc-url-action.component";

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

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-04-15 07:29:56

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

在aslaURLActionComponent组件中:

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

在Ng模块中:-

@NgModule({声明: PagesComponent、ActionComponent、ActionURLComponent、CCURLActionComponent、aslaURLActionComponent })

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55376006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档