mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-24 14:58:36 +08:00
chore(): begin adding ionic components to mono-repo.
This commit is contained in:
@ -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;
|
||||
}
|
@ -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
packages/ionic-angular/demos/src/navigation/app/main.ts
Normal file
5
packages/ionic-angular/demos/src/navigation/app/main.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
@ -0,0 +1,14 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>Navigation</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<ion-button block (click)="push()">Push New Page</ion-button>
|
||||
|
||||
</ion-content>
|
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { IonicPageModule } from '../../../../../src';
|
||||
|
||||
import { PageOne } from './page-one';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PageOne,
|
||||
],
|
||||
imports: [
|
||||
IonicPageModule.forChild(PageOne),
|
||||
],
|
||||
entryComponents: [
|
||||
PageOne,
|
||||
]
|
||||
})
|
||||
export class PageOneModule {}
|
@ -0,0 +1,14 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NavController } from '../../../../../src';
|
||||
import { PageTwo }from '../page-two/page-two';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'page-one.html'
|
||||
})
|
||||
export class PageOne {
|
||||
constructor(public navCtrl: NavController) {}
|
||||
|
||||
push() {
|
||||
this.navCtrl.push(PageTwo);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>Page {{pageNum}}</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<ion-button block (click)="push()">Push Another Page</ion-button>
|
||||
<ion-button color="secondary" block (click)="pop()">Pop This Page</ion-button>
|
||||
|
||||
</ion-content>
|
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { IonicPageModule } from '../../../../../src';
|
||||
|
||||
import { PageTwo } from './page-two';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PageTwo,
|
||||
],
|
||||
imports: [
|
||||
IonicPageModule.forChild(PageTwo),
|
||||
],
|
||||
entryComponents: [
|
||||
PageTwo,
|
||||
]
|
||||
})
|
||||
export class PageTwoModule {}
|
@ -0,0 +1,25 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NavController } from '../../../../../src';
|
||||
|
||||
let pageNum = 2;
|
||||
|
||||
@Component({
|
||||
templateUrl: 'page-two.html'
|
||||
})
|
||||
export class PageTwo {
|
||||
pageNum = pageNum;
|
||||
|
||||
constructor(public navCtrl: NavController) {}
|
||||
|
||||
push() {
|
||||
pageNum++;
|
||||
this.navCtrl.push(PageTwo);
|
||||
}
|
||||
|
||||
pop() {
|
||||
if (pageNum > 2) {
|
||||
pageNum--;
|
||||
}
|
||||
this.navCtrl.pop();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user