我有核心app.module
和自定义组件ErrorsComponent
。
我在app.module
中将此组件声明为:
declarations: [AppComponent, ExtractSuffixPipe, KeysPipe, HomeComponent, ErrorsComponent ],
exports: [
ErrorsComponent
],
之后我仍然收到错误:
Can't bind to 'errors' since it isn't a known property of 'app-errors'.
1. If 'app-errors' is an Angular component and it has 'errors' input, then verify that it is part of this module.
抱歉,该组件有自己的模块:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TextMaskModule } from 'angular2-text-mask';
import { ReCaptchaModule } from 'angular2-recaptcha';
@NgModule({
imports: [
FormsModule,
CommonModule,
ReactiveFormsModule,
TranslateModule,
NgbModule,
TextMaskModule,
ReCaptchaModule
],
providers: [
Captcha,
ApiUrls,
Credentials,
TimerService,
SmsService,
UserService,
LocalService
]
})
export class ErrorsModule { }
AppModule
是:
从“./errors/errors.component”导入{ErrorsComponent};
@NgModule({
declarations: [AppComponent, ExtractSuffixPipe, KeysPipe, HomeComponent, ErrorsComponent ],
exports: [
ErrorsComponent
]...