From cbb4b91ad39b44a76d1b1d4b745ef2b38fab74ce Mon Sep 17 00:00:00 2001 From: cyuamber Date: Wed, 28 Aug 2019 15:17:26 +0800 Subject: bug: menu bar bug fixed Change-Id: I84dd884d6dbcd2831be238629eb5e0ba8ef8d1cc Issue-ID: USECASEUI-307 Signed-off-by: cyuamber --- usecaseui-portal/src/app/app.component.ts | 74 +++++++++---------------------- 1 file changed, 20 insertions(+), 54 deletions(-) (limited to 'usecaseui-portal/src/app/app.component.ts') diff --git a/usecaseui-portal/src/app/app.component.ts b/usecaseui-portal/src/app/app.component.ts index d654900c..7306db1c 100644 --- a/usecaseui-portal/src/app/app.component.ts +++ b/usecaseui-portal/src/app/app.component.ts @@ -17,7 +17,8 @@ import {Component} from '@angular/core'; import {TranslateService} from '@ngx-translate/core'; import {MyhttpService} from "./core/services/myhttp.service"; import {HomesService} from "./core/services/homes.service"; - +import {NavigationEnd, Router} from '@angular/router'; +import 'rxjs/add/operator/map'; @Component({ selector: 'app-root', @@ -25,10 +26,20 @@ import {HomesService} from "./core/services/homes.service"; styleUrls: ['./app.component.less'] }) export class AppComponent { + public url:string = 'home'; - constructor(private translate: TranslateService,private myhttp: HomesService) { + constructor(private translate: TranslateService,private myhttp: HomesService,private router:Router,) { this.currentLanguageGet(); - // translate.use('en'); + this.getUrl(); + + + } + getUrl(){ + this.router.events.map(event=> { + if(event instanceof NavigationEnd){ + this.url = event['url'].slice(1) + } + }).subscribe(event=>{}) } @@ -57,57 +68,12 @@ export class AppComponent { sessionStorage.setItem("DefaultLang",this.currentLanguage); } } - activeMenuBar =[true,false,false,false,false]; - activeMenuList =[false,false]; - thisActive(item){ - if(this.activeMenuBar[item] == true){ - this.activeMenuBar.map((its,index) => { - if(item != index){ - this.activeMenuBar[index] = false; - } - }) - }else { - this.activeMenuBar.map((its,index) => { - if(item == index){ - this.activeMenuBar[item] = true; - }else { - this.activeMenuBar[index] = false; - } - }) - this.activeMenuList.map((its,index) => { - this.activeMenuList[index] = false; - }) + get flag () { + if(!this.url.indexOf('services')){ + return true + }else{ + return false } } - thisListActive(item){ - if(this.activeMenuBar[3] = true){ - if(this.activeMenuList[item] == true){ - this.activeMenuList.map((its,index) => { - if(item != index){ - this.activeMenuList[index] = false; - } - }) - }else { - this.activeMenuList.map((its,index) => { - if(item == index){ - this.activeMenuList[item] = true; - }else { - this.activeMenuList[index] = false; - } - }) - - } - }else { - this.activeMenuList.map((its,index) => { - this.activeMenuList[index] = false; - }) - } - } - // - // selectLanguage = "en"; - - // changeLanguage(item){ - // this.selectLanguage = item; - // this.translate.use(item); - // } + } -- cgit 1.2.3-korg