From 856002ef0caaaf4737b020d5f71a88052d3d7625 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Thu, 4 Feb 2016 14:25:51 -0500 Subject: [PATCH] docs(demos): add id API demo references driftyco/ionic-site#397 --- demos/id/index.ts | 29 +++++++++++++++++++++++++++++ demos/id/main.html | 34 ++++++++++++++++++++++++++++++++++ demos/id/page1.html | 23 +++++++++++++++++++++++ ionic/components/app/id.ts | 2 ++ 4 files changed, 88 insertions(+) create mode 100644 demos/id/index.ts create mode 100644 demos/id/main.html create mode 100644 demos/id/page1.html diff --git a/demos/id/index.ts b/demos/id/index.ts new file mode 100644 index 0000000000..53ec8f76d6 --- /dev/null +++ b/demos/id/index.ts @@ -0,0 +1,29 @@ +import {App, IonicApp, Page} from 'ionic/ionic'; + +@Page({templateUrl: 'page1.html'}) +class Page1 { + constructor(app: IonicApp) { + this.app = app; + this.menu1Active(); + } + menu1Active() { + this.activeMenu = 'menu1'; + this.app.getComponent('menu1').enable(true); + this.app.getComponent('menu2').enable(false); + } + menu2Active() { + this.activeMenu = 'menu2'; + this.app.getComponent('menu1').enable(false); + this.app.getComponent('menu2').enable(true); + } +} + +@App({ + templateUrl: 'main.html' +}) +class ApiDemoApp { + constructor(app: IonicApp) { + this.app = app; + this.rootView = Page1; + } +} diff --git a/demos/id/main.html b/demos/id/main.html new file mode 100644 index 0000000000..f33edaad89 --- /dev/null +++ b/demos/id/main.html @@ -0,0 +1,34 @@ + + + + Menu 1 + + + + + + + + + + + + + + + Menu 2 + + + + + + + + + + + diff --git a/demos/id/page1.html b/demos/id/page1.html new file mode 100644 index 0000000000..f0afa3c520 --- /dev/null +++ b/demos/id/page1.html @@ -0,0 +1,23 @@ + + + + Id + + + + + + +

Active Menu: {{ (activeMenu == 'menu1') ? 'Menu 1' : 'Menu 2' }}

+ +

This page has two menus with different id's, but only one is active at a time.

+ + + + + + + +
diff --git a/ionic/components/app/id.ts b/ionic/components/app/id.ts index 96273533c0..cca91f0c97 100644 --- a/ionic/components/app/id.ts +++ b/ionic/components/app/id.ts @@ -35,6 +35,8 @@ import {IonicApp} from './app'; * *NOTE:* It is not recommended to use ID's across Pages, as there is often no * guarantee that the registered component has not been destroyed if its Page * has been navigated away from. + * + * @demo /docs/v2/demos/id/ */ @Directive({ selector: '[id]'