mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
chore(): begin adding ionic components to mono-repo.
This commit is contained in:
38
packages/ionic-angular/demos/src/menu/app/app.component.html
Normal file
38
packages/ionic-angular/demos/src/menu/app/app.component.html
Normal file
@ -0,0 +1,38 @@
|
||||
<ion-menu [content]="content" id="menu1">
|
||||
|
||||
<ion-header>
|
||||
<ion-toolbar color="secondary">
|
||||
<ion-title>Menu 1</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<button ion-item menuClose="menu1" detail-none>
|
||||
Close Menu 1
|
||||
</button>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
||||
</ion-menu>
|
||||
|
||||
|
||||
<ion-menu [content]="content" id="menu2">
|
||||
|
||||
<ion-header>
|
||||
<ion-toolbar color="danger">
|
||||
<ion-title>Menu 2</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<button ion-item menuClose="menu2" detail-none>
|
||||
Close Menu 2
|
||||
</button>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
||||
</ion-menu>
|
||||
|
||||
<ion-nav [root]="root" #content swipeBackEnabled="false"></ion-nav>
|
@ -0,0 +1,9 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { PageOne } from '../pages/page-one/page-one';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'app.component.html'
|
||||
})
|
||||
export class AppComponent {
|
||||
root = PageOne;
|
||||
}
|
19
packages/ionic-angular/demos/src/menu/app/app.module.ts
Normal file
19
packages/ionic-angular/demos/src/menu/app/app.module.ts
Normal file
@ -0,0 +1,19 @@
|
||||
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';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
IonicModule.forRoot(AppComponent),
|
||||
PageOneModule
|
||||
],
|
||||
bootstrap: [IonicApp]
|
||||
})
|
||||
export class AppModule {}
|
5
packages/ionic-angular/demos/src/menu/app/main.ts
Normal file
5
packages/ionic-angular/demos/src/menu/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,27 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-button [menuToggle]="activeMenu">
|
||||
<ion-icon name="menu"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-title>
|
||||
Menu
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<h4>Active Menu: <b color="primary">{{ (activeMenu == 'menu1') ? 'Menu 1' : 'Menu 2' }}</b></h4>
|
||||
|
||||
<p>This page has two menus with different id's, but only one is active at a time.</p>
|
||||
|
||||
<ion-button block color="secondary" (click)="menu1Active()">Make Menu 1 Active</ion-button>
|
||||
|
||||
<ion-button block color="danger" (click)="menu2Active()">Make Menu 2 Active</ion-button>
|
||||
|
||||
<ion-button block [menuToggle]="activeMenu">Toggle Menu</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,23 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { MenuController } from '../../../../../src';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'page-one.html'
|
||||
})
|
||||
export class PageOne {
|
||||
activeMenu: string;
|
||||
|
||||
constructor(public menu: MenuController) {
|
||||
this.menu1Active();
|
||||
}
|
||||
menu1Active() {
|
||||
this.activeMenu = 'menu1';
|
||||
this.menu.enable(true, 'menu1');
|
||||
this.menu.enable(false, 'menu2');
|
||||
}
|
||||
menu2Active() {
|
||||
this.activeMenu = 'menu2';
|
||||
this.menu.enable(false, 'menu1');
|
||||
this.menu.enable(true, 'menu2');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user