angular - 'menu-list' is not a known element lazy loading -
i using lazy loading in ionic 3.6.1 , got follow error. idea issue?
'menu-list' not known element:
1. if 'menu-list' angular component, verify part of module.
2. if 'menu-list' web component add 'custom_elements_schema' '@ngmodule.schemas' of component suppress message.
home.html
<menu-list></menu-list> home.module.ts
import { ngmodule } '@angular/core'; import { ionicpagemodule } 'ionic-angular'; import { homepage } './home'; import { menulistcomponent } "../../components/menu-list/menu-list"; @ngmodule({ declarations: [ homepage, ], imports: [ ionicpagemodule.forchild(homepage), menulistcomponent ], }) export class homepagemodule {} menu-list.ts
import { component } '@angular/core'; @component({ selector: 'menu-list', templateurl: 'menu-list.html' }) export class menulistcomponent { text: string; constructor() { console.log('hello menulistcomponent component'); this.text = 'hello world'; } } components.module.ts (generated, no modified)
import { ngmodule } '@angular/core'; import { menulistcomponent } './menu-list/menu-list'; @ngmodule({ declarations: [menulistcomponent], imports: [], exports: [menulistcomponent] }) export class componentsmodule {}
you need import componentsmodule in component exported , not component itself.
check official blog here. in home.module.ts
@ngmodule({ declarations: [ homepage, ], imports: [ ionicpagemodule.forchild(homepage), componentsmodule //here ], }) export class homepagemodule {}
Comments
Post a Comment