From a434c465455d63a3961e778abca82150186cf171 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Nov 2017 17:11:07 +0100 Subject: Change tab when changing follow url --- client/src/app/+admin/follows/follows.component.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/src/app/+admin/follows/follows.component.ts b/client/src/app/+admin/follows/follows.component.ts index 97422a41b..a1be82585 100644 --- a/client/src/app/+admin/follows/follows.component.ts +++ b/client/src/app/+admin/follows/follows.component.ts @@ -1,11 +1,12 @@ -import { AfterViewInit, Component, ViewChild } from '@angular/core' +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' +import { NavigationEnd, Router } from '@angular/router' import { TabsetComponent } from 'ngx-bootstrap/tabs' @Component({ templateUrl: './follows.component.html', styleUrls: [ './follows.component.scss' ] }) -export class FollowsComponent implements AfterViewInit { +export class FollowsComponent implements OnInit, AfterViewInit { @ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent links = [ @@ -23,6 +24,18 @@ export class FollowsComponent implements AfterViewInit { } ] + constructor (private router: Router) {} + + ngOnInit () { + this.router.events.subscribe( + event => { + if (event instanceof NavigationEnd) { + this.updateActiveTab() + } + } + ) + } + ngAfterViewInit () { // Avoid issue with change detector setTimeout(() => this.updateActiveTab()) -- cgit v1.2.3