i have a project that is lazy loaded, it has 2 modules view.module.ts and view2.modules.ts other than module.ts. i want to use a component called editform.component.ts in both modules. is it possible??
To use component you can use a shared module.
@NgModule({
imports: [
SomeModule
],
declarations: [
SharedComponent
],
exports: [
SharedComponent
]
})
export class SharedModule {}
Now inside that shared module you can add the component that you want to share. Do not forget to put them into exports.
Now add this module into your app.module.ts
import { SharedModule } from './shared/shared.module;
@NgModule({
imports: [ SharedModule],
...
})
Now you can use the shared component via app.module.ts. Hope this might solve your problem.