From beacf6993c93f93bf5ea86665827154eb291d1fd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 21 Aug 2016 11:27:24 +0200 Subject: Client: simplify simple menu/admin menu displaying logic --- client/src/app/app.component.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'client/src/app/app.component.ts') diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index d9549ad5b..2e0fd13f1 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { ROUTER_DIRECTIVES } from '@angular/router'; +import { Router, ROUTER_DIRECTIVES } from '@angular/router'; import { MenuAdminComponent } from './admin'; import { MenuComponent } from './menu.component'; @@ -15,13 +15,9 @@ import { VideoService } from './videos'; }) export class AppComponent { - isInAdmin = false; + constructor(private router: Router) {} - onEnteredInAdmin() { - this.isInAdmin = true; - } - - onQuittedAdmin() { - this.isInAdmin = false; + isInAdmin() { + return this.router.url.indexOf('/admin/') !== -1; } } -- cgit v1.2.3