为什么项目中的导入组件不起作用?

时间:2017-09-19 11:45:18

标签: angular

我有核心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
  ]...

0 个答案:

没有答案