ionic2一个需求模块的文件该是这样子的
1、组件文件夹的文件
除了index.ts 其他文件为各个页面组件文件
2、index.ts的代码如下
import {SecurityFinance} from "./security-finance";
import {SecurityApply} from "./security-apply";
import {SecurityDisclaimer} from "./security-disclaimer";
export const FINANCE = [
SecurityFinance,
SecurityApply,
SecurityDisclaimer
]
3.在APP.module.ts文件中引入(注意加粗,其他代码不在此展示)
import {CheckPage} from './../pages/startup/check';
import {FINANCE} from './../pages/security-finance/index';
import {TranslateModule, TranslateStaticLoader, TranslateLoader} from "ng2-translate";
import {Http} from '@angular/http';
export function createTranslateLoader(http: Http) {
return new TranslateStaticLoader(http, './assets/i18n', '.json');
}
@NgModule({
declarations: [
MyApp,
WIDGETS,
SecurityFinance,
FINANCE
],
imports: [
IonicModule.forRoot(MyApp, {}, {
links: [
}),
HttpInterceptorModule.withInterceptors([
{
deps: [Platform],
provide: HttpInterceptor,
useClass: AuthInterceptor,
multi: true
}
]),
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [Http]
}),
ChartModule
],
bootstrap: [IonicApp],
entryComponents: [
FINANCE
],
providers: [SERVICE, Storage, {provide: ErrorHandler, useClass: IonicErrorHandler}]
})
export class AppModule {
}