From dfe19a962d51b4fe7c5d759fb75b7a0e7f3e0405 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sun, 4 Oct 2015 11:45:32 -0500 Subject: [PATCH] use title service --- ionic/components/app/app.ts | 13 ++++++++----- ionic/components/button/test/basic/index.ts | 8 ++++++-- ionic/components/nav-bar/nav-bar.ts | 2 +- ionic/config/bootstrap.ts | 16 ++++++++-------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/ionic/components/app/app.ts b/ionic/components/app/app.ts index 357772d4aa..ebf55d1e36 100644 --- a/ionic/components/app/app.ts +++ b/ionic/components/app/app.ts @@ -1,4 +1,4 @@ -import {Component, View, ElementRef, NgZone, DynamicComponentLoader} from 'angular2/angular2'; +import {Title} from 'angular2/angular2'; import {ClickBlock} from '../../util/click-block'; import {ScrollTo} from '../../animations/scroll-to'; @@ -31,7 +31,7 @@ export class IonicApp { * TODO */ constructor() { - this.overlays = []; + this._title = new Title(); this._disTime = 0; this._trnsTime = 0; @@ -43,9 +43,12 @@ export class IonicApp { * Sets the document title. * @param {string} val Value to set the document title to. */ - title(val) { - // TODO: User angular service - document.title = val; + setTitle(val) { + this._title.setTitle(val); + } + + getTitle() { + return this._title.getTitle(val); } /** diff --git a/ionic/components/button/test/basic/index.ts b/ionic/components/button/test/basic/index.ts index 43aed36502..ff6f299c59 100644 --- a/ionic/components/button/test/basic/index.ts +++ b/ionic/components/button/test/basic/index.ts @@ -1,7 +1,11 @@ -import {App} from 'ionic/ionic'; +import {App, IonicApp} from 'ionic/ionic'; @App({ templateUrl: 'main.html' }) -class E2EApp {} +class E2EApp { + constructor(app: IonicApp) { + app.setTitle('Basic Buttons'); + } +} diff --git a/ionic/components/nav-bar/nav-bar.ts b/ionic/components/nav-bar/nav-bar.ts index 108dbee8b2..2aed612e53 100644 --- a/ionic/components/nav-bar/nav-bar.ts +++ b/ionic/components/nav-bar/nav-bar.ts @@ -104,7 +104,7 @@ export class Navbar extends ToolbarBase { } didEnter() { - this.app.title(this.getTitleText()); + this.app.setTitle(this.getTitleText()); } } diff --git a/ionic/config/bootstrap.ts b/ionic/config/bootstrap.ts index 33d3e1821f..4dcb53e6f0 100644 --- a/ionic/config/bootstrap.ts +++ b/ionic/config/bootstrap.ts @@ -19,9 +19,9 @@ export function ionicBindings(configSettings) { let app = new IonicApp(); let platform = new IonicPlatform(); let config = new IonicConfig(configSettings); + let events = new Events(); let tapClick = new TapClick(app, config, window, document); - // load all platform data platform.url(window.location.href); platform.userAgent(window.navigator.userAgent); platform.navigatorPlatform(window.navigator.platform); @@ -112,20 +112,20 @@ function setupDom(window, document, config, platform) { * Bind some global events and publish on the 'app' channel */ function bindEvents(window, document, platform, events) { - window.addEventListener('online', (event) => { - events.publish('app:online', event); + window.addEventListener('online', (ev) => { + events.publish('app:online', ev); }, false); - window.addEventListener('offline', (event) => { - events.publish('app:offline', event); + window.addEventListener('offline', (ev) => { + events.publish('app:offline', ev); }, false); - window.addEventListener('orientationchange', (event) => { - events.publish('app:rotated', event); + window.addEventListener('orientationchange', (ev) => { + events.publish('app:rotated', ev); }); // When that status taps, we respond - window.addEventListener('statusTap', (event) => { + window.addEventListener('statusTap', (ev) => { // TODO: Make this more better var el = document.elementFromPoint(platform.width() / 2, platform.height() / 2); if(!el) { return; }