After upgrading my angular version from 4.3.6 to 5.2.4, the AOT compile now throws the error:
ERROR in : Cannot determine the module for class InlineAddComponent in .../src/app/core/component/input/inline-add/inline-add.component.ts! Add InlineAddComponent to the NgModule to fix it.
This Component is declared as part of a module and everything was working flawlessly with AOT compilation prior to the upgrading. I've tried everything I can think of, from changing the module where the component is declared to creating its own module and importing it into the module that was previously declaring it. No matter what, the compiler still complains.
If anyone else has experienced, or resolved this issue, I'd appreciate the insight.
Component:
import {Component, Inject, Input} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
import {ActivatedRoute} from '@angular/router';
import {BaseForm} from '../../form/form/BaseForm';
import {FormDataService, FormDataServiceProvider} from '../../form/form/FormDataService';
import {BaseApi} from '../../../api/BaseApi';
@Component({
selector: 'inline-add',
templateUrl: './inline-add.component.html',
styleUrls: ['./inline-add.component.scss'],
providers: [
FormDataServiceProvider
]
})
export class InlineAddComponent extends BaseForm {
@Input() title = 'Entity';
@Input() formName;
protected service: BaseApi;
constructor(
protected route: ActivatedRoute,
protected formDataService: FormDataService,
public dialogRef: MatDialogRef<InlineAddComponent>,
@Inject(MAT_DIALOG_DATA) public data: {
form: string,
title: string,
service: BaseApi,
},
) {
super();
this.title = data.title;
this.formName = data.form;
this.service = data.service;
}
submit() {
super.onSubmit(res => {
this.dialogRef.close(res.data[0]);
});
}
onCancel() {
this.dialogRef.close(false);
}
}
Declaring Module:
import { NgModule } from '@angular/core';
import {SharedModule} from '../../../shared/shared.module';
import {InlineAddComponent} from './inline-add/inline-add.component';
@NgModule({
imports: [
SharedModule,
],
declarations: [
InlineAddComponent,
],
exports: [
InlineAddComponent,
],
entryComponents: [
InlineAddComponent,
]
})
export class FormInputsModule { }