ionic3 新建组件 提示 ion-xxx is not a known element

通过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 { }

 

posted @ 2020-06-12 14:49  johnjackson  阅读(980)  评论(0编辑  收藏  举报