通過ionic g componennt xxx 創建一個組件,然后在組件中的html中寫的ion-xxx標簽 會提示未知元素,
解決方法:
在components.module.ts中引入
import { NgModule } from '@angular/core'; import { NavbarComponent } from './navbar/navbar'; import { IonicModule } from 'ionic-angular'; @NgModule({ declarations: [NavbarComponent], imports: [ IonicModule ], exports: [NavbarComponent] }) export class ComponentsModule { }