From e522d2e0ffef02cf39453d83e1c7c7d64c417e8c Mon Sep 17 00:00:00 2001 From: Drew Rygh Date: Tue, 8 Dec 2015 15:31:59 -0600 Subject: [PATCH 1/2] docs(demos): local storage api demo --- demos/local-storage/app.html | 2 ++ demos/local-storage/index.ts | 38 ++++++++++++++++++++++++++ demos/local-storage/main.html | 50 +++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 demos/local-storage/app.html create mode 100644 demos/local-storage/index.ts create mode 100644 demos/local-storage/main.html diff --git a/demos/local-storage/app.html b/demos/local-storage/app.html new file mode 100644 index 0000000000..5f6bb33d68 --- /dev/null +++ b/demos/local-storage/app.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/demos/local-storage/index.ts b/demos/local-storage/index.ts new file mode 100644 index 0000000000..958291f4dd --- /dev/null +++ b/demos/local-storage/index.ts @@ -0,0 +1,38 @@ +import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic'; +import {Storage, LocalStorage} from 'ionic/ionic'; + + +@App({ + templateUrl: 'app.html' +}) +class ApiDemoApp { + + constructor() { + this.rootPage = InitialPage; + } +} + +@Page({ + templateUrl: 'main.html' +}) +export class InitialPage { + constructor() { + this.local = new Storage(LocalStorage); + this.myItem = {}; + this.delKey = ''; + this.localStorageDemo = '{}'; + window.localStorage.clear(); + } + + set() { + this.local.set(this.myItem.key, this.myItem.value ); + this.localStorageDemo = JSON.stringify(window.localStorage, null, 2); + this.myItem = {}; + } + + remove() { + this.local.remove(this.delKey); + this.localStorageDemo = JSON.stringify(window.localStorage, null, 2); + this.delKey = ''; + } +} diff --git a/demos/local-storage/main.html b/demos/local-storage/main.html new file mode 100644 index 0000000000..6f77643bc0 --- /dev/null +++ b/demos/local-storage/main.html @@ -0,0 +1,50 @@ + + Local Storage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Local Storage: + + {{localStorageDemo}} + + + From 397b753567654b1d72b2ee6027ddb7e392c98445 Mon Sep 17 00:00:00 2001 From: Drew Rygh Date: Tue, 8 Dec 2015 16:13:54 -0600 Subject: [PATCH 2/2] docs(demos): nav push/pop api demo --- demos/nav-push-pop/app.html | 2 ++ demos/nav-push-pop/index.ts | 52 ++++++++++++++++++++++++++++++++++ demos/nav-push-pop/main.html | 9 ++++++ demos/nav-push-pop/page-2.html | 12 ++++++++ 4 files changed, 75 insertions(+) create mode 100644 demos/nav-push-pop/app.html create mode 100644 demos/nav-push-pop/index.ts create mode 100644 demos/nav-push-pop/main.html create mode 100644 demos/nav-push-pop/page-2.html diff --git a/demos/nav-push-pop/app.html b/demos/nav-push-pop/app.html new file mode 100644 index 0000000000..5f6bb33d68 --- /dev/null +++ b/demos/nav-push-pop/app.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/demos/nav-push-pop/index.ts b/demos/nav-push-pop/index.ts new file mode 100644 index 0000000000..45490f7cc1 --- /dev/null +++ b/demos/nav-push-pop/index.ts @@ -0,0 +1,52 @@ +import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic'; +import {NavController, NavParams} from 'ionic/ionic'; + +var PAGE_NUM = 2; + +@App({ + templateUrl: 'app.html' +}) +class ApiDemoApp { + + constructor() { + this.rootPage = InitialPage; + } +} + +@Page({ + templateUrl: 'main.html' +}) +export class InitialPage { + constructor(nav: NavController) { + this.nav = nav; + } + + push() { + this.nav.push(Page2); + } +} + +@Page({ + templateUrl: "page-2.html" +}) +export class Page2 { + constructor( + nav: NavController, + ) { + this.nav = nav; + this.pageNum = PAGE_NUM; + } + + push() { + PAGE_NUM++; + this.nav.push(Page2); + } + + pop() { + if (PAGE_NUM > 2) { + PAGE_NUM--; + } + this.nav.pop(); + } +} + diff --git a/demos/nav-push-pop/main.html b/demos/nav-push-pop/main.html new file mode 100644 index 0000000000..65fc1b97fe --- /dev/null +++ b/demos/nav-push-pop/main.html @@ -0,0 +1,9 @@ + + Nav Push/Pop + + + + + + + diff --git a/demos/nav-push-pop/page-2.html b/demos/nav-push-pop/page-2.html new file mode 100644 index 0000000000..553012fd78 --- /dev/null +++ b/demos/nav-push-pop/page-2.html @@ -0,0 +1,12 @@ + + Page {{pageNum}} + + + + + + + + + +