|
对于刚接触ionic3的朋友可能还摸不着头绪,那么需要从比较基础来逐步了解学习。Ionic3.x中app.module.ts具体是怎样呢?
下面我们通过下面的代码来进行了解:(注:资料来源于 IT营 ionic3.x仿京东商城项目实战免费视频教程)
ionic3教程网盘下载地址:https://pan.baidu.com/s/1eTyvq5W
更多ionic教程详细资料可访问:https://www.itying.com/goods-460.html
- /这个根模块会告诉 ionic 如何组装该应用
- import { NgModule, ErrorHandler } from '@angular/core';
- import { BrowserModule } from '@angular/platform-browser';
- import { ComponentsModule } from '../components/components.module';
- import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
- import { MyApp } from './app.component'; /*根组件*/
- //其他组件
复制代码- import { AboutPage } from '../pages/about/about';
- import { ContactPage } from '../pages/contact/contact';
- import { HomePage } from '../pages/home/home';
- import { NewsPage } from '../pages/news/news';
- //底部tab切换
- import { TabsPage } from '../pages/tabs/tabs';
- import { StatusBar } from '@ionic-native/status-bar';
- import { SplashScreen } from '@ionic-native/splash-screen';
- @NgModule({
- declarations: [
- MyApp,
- AboutPage,
- ContactPage,
- HomePage,
- NewsPage,
- TabsPage
- ],
- imports: [
- BrowserModule,
- ComponentsModule,
- IonicModule.forRoot(MyApp)
- ],
- bootstrap: [IonicApp],
- entryComponents: [ /*配置不会在模板中使用的组件*/
- MyApp,
- AboutPage,
- ContactPage,
- HomePage,
- NewsPage,
- TabsPage
- ],
- providers: [
- StatusBar,
- SplashScreen,
- {provide: ErrorHandler, useClass: IonicErrorHandler}
- ]
- })
- export class AppModule {}
复制代码
|
|