use title service

This commit is contained in:
Adam Bradley
2015-10-04 11:45:32 -05:00
parent 2b86705f54
commit dfe19a962d
4 changed files with 23 additions and 16 deletions

View File

@@ -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);
}
/**

View File

@@ -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');
}
}

View File

@@ -104,7 +104,7 @@ export class Navbar extends ToolbarBase {
}
didEnter() {
this.app.title(this.getTitleText());
this.app.setTitle(this.getTitleText());
}
}

View File

@@ -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; }