mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
docs(demos): update api demos to modular structure
update api demos to modular structure
This commit is contained in:
9
demos/src/loading/app/app.component.ts
Normal file
9
demos/src/loading/app/app.component.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { PageOne } from '../pages/page-one/page-one';
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
export class AppComponent {
|
||||
root = PageOne;
|
||||
}
|
21
demos/src/loading/app/app.module.ts
Normal file
21
demos/src/loading/app/app.module.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { IonicApp, IonicModule } from '../../../../src';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { PageOneModule } from '../pages/page-one/page-one.module';
|
||||
import { PageTwoModule } from '../pages/page-two/page-two.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
IonicModule.forRoot(AppComponent),
|
||||
PageOneModule,
|
||||
PageTwoModule
|
||||
],
|
||||
bootstrap: [IonicApp]
|
||||
})
|
||||
export class AppModule {}
|
5
demos/src/loading/app/main.ts
Normal file
5
demos/src/loading/app/main.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
17
demos/src/loading/pages/page-one/page-one.module.ts
Normal file
17
demos/src/loading/pages/page-one/page-one.module.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../src';
|
||||
|
||||
import { PageOne } from './page-one';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PageOne,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(PageOne),
|
||||
],
|
||||
entryComponents: [
|
||||
PageOne,
|
||||
]
|
||||
})
|
||||
export class PageOneModule {}
|
@ -1,11 +1,11 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { IonicApp, IonicModule, LoadingController, NavController } from '../../ionic-angular';
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { LoadingController, NavController } from '../../../../../src';
|
||||
import { PageTwo } from '../page-two/page-two';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'page.html'
|
||||
templateUrl: 'page-one.html'
|
||||
})
|
||||
export class Page1 {
|
||||
export class PageOne {
|
||||
constructor(public loadingCtrl: LoadingController, public navCtrl: NavController) {}
|
||||
|
||||
presentLoadingIos() {
|
||||
@ -99,7 +99,7 @@ export class Page1 {
|
||||
loading.present();
|
||||
|
||||
setTimeout(() => {
|
||||
this.navCtrl.push(Page2);
|
||||
this.navCtrl.push(PageTwo);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
@ -107,42 +107,3 @@ export class Page1 {
|
||||
}, 4000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>Page 2</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content padding>This is another page!</ion-content>
|
||||
`
|
||||
})
|
||||
export class Page2 {}
|
||||
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
export class ApiDemoApp {
|
||||
root = Page1;
|
||||
}
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ApiDemoApp,
|
||||
Page1,
|
||||
Page2
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(ApiDemoApp)
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
Page1,
|
||||
Page2
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
17
demos/src/loading/pages/page-two/page-two.module.ts
Normal file
17
demos/src/loading/pages/page-two/page-two.module.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../src';
|
||||
|
||||
import { PageTwo } from './page-two';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PageTwo,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(PageTwo),
|
||||
],
|
||||
entryComponents: [
|
||||
PageTwo,
|
||||
]
|
||||
})
|
||||
export class PageTwoModule {}
|
13
demos/src/loading/pages/page-two/page-two.ts
Normal file
13
demos/src/loading/pages/page-two/page-two.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>Page 2</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content padding>This is another page!</ion-content>
|
||||
`
|
||||
})
|
||||
export class PageTwo {}
|
Reference in New Issue
Block a user