Removes pagename.

This commit is contained in:
GloriousCode
2017-10-10 17:52:12 +11:00
parent ace0c9a6a9
commit f66ce8e159
3 changed files with 23 additions and 19 deletions

View File

@@ -1,5 +1,8 @@
import { Component } from '@angular/core';
import { Component, OnInit,ViewChild } from '@angular/core';
import { ElectronService } from './providers/electron.service';
import { MdSidenav } from '@angular/material';
import { SidebarService } from './services/sidebar/sidebar.service';
import { Router, NavigationEnd } from '@angular/router';
@Component({
selector: 'app-root',
@@ -7,7 +10,11 @@ import { ElectronService } from './providers/electron.service';
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
constructor(public electronService: ElectronService) {
sidebarService: SidebarService
public currentUrl:string;
@ViewChild('sidenav') public sidenav: MdSidenav;
constructor(public electronService: ElectronService,something: SidebarService, private router:Router) {
if (electronService.isElectron()) {
console.log('Mode electron');
@@ -18,5 +25,19 @@ export class AppComponent {
} else {
console.log('Mode web');
}
this.sidebarService = something;
router.events.subscribe(event => {
if (event instanceof NavigationEnd ) {
console.log("current url",event.url); // event.url has current url
this.currentUrl = event.url;
}
});
}
ngOnInit() {
this.sidebarService.setSidenav(this.sidenav);
}
}