#angular
#angular
Вопрос:
Он показывает ошибку:
Не удается определить модуль для класса CCURLActionComponent в C:/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;
}
Приведенный выше код одинаков для cc-url-action.component и asla-url-action.component в файле ts
В pages.module.ts:
import { CCURLActionComponent } from "./header/action/CCAction/CCActionURL/cc-url-action.component";
@NgModule({
declarations: [
PagesComponent,
ActionComponent,
ActionURLComponent,
CCURLActionComponent
Ответ №1:
Решил проблему, изменив это-
В качестве компонента laurlactioncomponent:-
@Injectable() экспортирует класс, поскольку он расширяет CCURLActionComponent, реализует OnInit { }
И в модуле Ng:-
@NgModule({ объявления: [ PagesComponent, ActionComponent, ActionURLComponent, CCURLActionComponent, aslaURLActionComponent ] })