首先需要在模块中新建一个 xxx.module.ts 文件 把这个模块导出
文件:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AddressListComponent } from "./address-list";
@NgModule({
imports: [ CommonModule ],
declarations: [ AddressListComponent ],
exports: [
AddressListComponent,
],
providers: [],
})
export class AddressListModule { }
之后在需要引入这个模块的地方的 module 文件中的 imports 引入 AddressListModule 即可
现在这个 AddressListModule 模块已经可以被多个页面引用了
文件:
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { AddressPage } from './address';
import { AddressListModule } from "../../components/address-list/address-list.module";
@NgModule({
declarations: [
AddressPage,
],
imports: [
//把需要的模块引入即可
AddressListModule,
IonicPageModule.forChild(AddressPage),
],
exports: [
AddressPage
]
})
export class AddressPageModule {}
------end------
网友评论