style(CompileMetadataResolver): better error message (#11401)

This commit is contained in:
PatrickJS
2016-09-07 14:09:25 -07:00
committed by Evan Martin
parent dd03bf12e1
commit 3ff816afa6
2 changed files with 15 additions and 5 deletions

View File

@ -377,7 +377,9 @@ export class CompileMetadataResolver {
const oldModule = this._ngModuleOfTypes.get(type);
if (oldModule && oldModule !== moduleType) {
throw new Error(
`Type ${stringify(type)} is part of the declarations of 2 modules: ${stringify(oldModule)} and ${stringify(moduleType)}!`);
`Type ${stringify(type)} is part of the declarations of 2 modules: ${stringify(oldModule)} and ${stringify(moduleType)}! ` +
`Please consider moving ${stringify(type)} to a higher module that imports ${stringify(oldModule)} and ${stringify(moduleType)}. ` +
`You can also create a new NgModule that exports and includes ${stringify(type)} then import that NgModule in ${stringify(oldModule)} and ${stringify(moduleType)}.`);
}
this._ngModuleOfTypes.set(type, moduleType);
}