Skip to content

Commit

Permalink
fixed merge issues
Browse files Browse the repository at this point in the history
changed navigate method of app.ts
  • Loading branch information
Matthew Wheatley committed Jun 6, 2016
1 parent b8511e7 commit bf884b2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
44 changes: 20 additions & 24 deletions app/client/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {MeteorComponent} from 'angular2-meteor';
import {App, IonicApp, Platform} from 'ionic-angular';
import {Component, NgZone, provide, Type} from '@angular/core';
import {Component, NgZone, provide, Type, ViewChild} from '@angular/core';
import {Http, HTTP_PROVIDERS} from '@angular/http';
import {TranslateService, TranslatePipe, TranslateLoader, TranslateStaticLoader} from 'ng2-translate/ng2-translate';
import {MeteorIonicApp} from "./lib/meteor-ionic-app";
Expand Down Expand Up @@ -33,10 +33,10 @@ declare var device;
})
class MyApp extends MeteorComponent {
// Set the root (or first) page
private rootPage:Type;
private pages:Array<{icon?: string, title: string, component: Type}>;
private rootPage:Type = HomePage;
private pages:Array<{icon?: string, title: string, component: Type, rootPage:boolean}>;
private appName:string;
//private user:Meteor.User;
private user:Meteor.User;

@ViewChild('leftMenu') leftMenu:any;
@ViewChild('content') nav:any;
Expand All @@ -51,20 +51,13 @@ class MyApp extends MeteorComponent {
ngOnInit():void {
this.initializeApp();

// set the root (or first) page
//if (Meteor.user()) {
this.rootPage = HomePage;
//} else {
// this.rootPage = LoginPage;
//}

// set the nav menu title to the application name from settings.json
this.appName = Meteor.settings.public.appName;

// set our app's pages
// title references a key in the language JSON to be translated by the translate pipe in the HTML
this.pages = [
{icon: "home", title: "home.title", component: HomePage},
{icon: "home", title: "home.title", component: HomePage, rootPage: true},
];

Tracker.autorun(() => this.zone.run(() => {
Expand Down Expand Up @@ -112,28 +105,31 @@ class MyApp extends MeteorComponent {
}

private openPage(page) {
let setRoot = false;
if (page.component === HomePage) {
setRoot = true;
}
this.navigate({page: page.component, setRoot: setRoot});
this.navigate({page: page.component, setRoot: page.setRoot});
}

private logout():void {
this.user = null;
Meteor.logout();
//this.navigate({page: LoginPage, setRoot: true});
}

private navigate(location:{page:any, setRoot:boolean}):void {
// close the menu when clicking a link from the menu
// getComponent selector is the component id attribute
this.leftMenu.close();
// navigate to the new page if it is not the current page
if (location.setRoot) {
this.nav.setRoot(location.page);
} else {
this.nav.push(location.page);
}
this.leftMenu.close().then(() => {
if (location.setRoot) {
this.nav.setRoot(location.page);
} else {
if (location.page) {
// navigate to the new page if it is not the current page
let viewCtrl = this.nav.getActive();
if (viewCtrl.componentType !== location.page) {
this.nav.push(location.page);
}
}
}
});
}

private setStyle():void {
Expand Down
4 changes: 2 additions & 2 deletions app/client/lib/meteor-ionic-app.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'reflect-metadata';
import 'zone.js/dist/zone';
import {provide, Type, Provider, IterableDiffers, Component, PLATFORM_DIRECTIVES, enableProdMode} from '@angular/core';
import {METEOR_PROVIDERS} from 'angular2-meteor';
import {bootstrap} from 'angular2-meteor-auto-bootstrap';
import {IonicApp, IONIC_DIRECTIVES, ionicProviders, postBootstrap} from 'ionic-angular';

import { Meteor } from 'meteor/meteor';

export function MeteorIonicApp(args: any = {}) {
return function(cls) {
// get annotations
Expand Down
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"angular2-meteor": "0.5.5",
"angular2-meteor-auto-bootstrap": "0.5.5",
"es6-promise": "3.2.1",
Expand Down

0 comments on commit bf884b2

Please sign in to comment.