aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/shared
diff options
context:
space:
mode:
authorIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-07-13 15:34:30 +0530
committerTakamune Cho <tc012c@att.com>2018-07-16 14:32:50 +0000
commit435e57ff2284e13fb7f9b0a1fae3ca1e0d02ccf8 (patch)
treea82bc1212912c475637c12efca43f5f15b2b0cbc /src/app/shared
parent0dd7dc4e6e5d315df7cc5195b53517883a229d40 (diff)
Unsubscribed from observable subscription.
Unsubscribed from observable in navigation component in ngOnDestroy method. This will dispose the resource that the subscription holds. Issue-ID: APPC-1049 Change-Id: I63203c7f3af9fb83b58bea91d9a21219611c7f7f Signed-off-by: Arundathi <arundpil@in.ibm.com>
Diffstat (limited to 'src/app/shared')
-rw-r--r--src/app/shared/components/navigation/navigation.component.ts22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/app/shared/components/navigation/navigation.component.ts b/src/app/shared/components/navigation/navigation.component.ts
index acddf9e..522b11a 100644
--- a/src/app/shared/components/navigation/navigation.component.ts
+++ b/src/app/shared/components/navigation/navigation.component.ts
@@ -2,6 +2,8 @@
============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+
+Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -22,24 +24,26 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-import {Component, Input, OnInit} from '@angular/core';
-import {Router} from '@angular/router';
-import {EmitterService} from '../../services/emitter.service';
+import { Component, Input, OnInit, OnDestroy } from '@angular/core';
+import { Router } from '@angular/router';
+import { Subscription } from 'rxjs/Subscription';
+import { EmitterService } from '../../services/emitter.service';
-@Component({selector: 'app-navigation', templateUrl: './navigation.component.html', styleUrls: ['./navigation.component.css']})
-export class NavigationComponent implements OnInit {
+@Component({ selector: 'app-navigation', templateUrl: './navigation.component.html', styleUrls: ['./navigation.component.css'] })
+export class NavigationComponent implements OnInit, OnDestroy {
navigationTabs: Array<Object> = [];
//@ViewChild(GoldenConfigurationComponent) goldenConfig: GoldenConfigurationComponent;
@Input() id: string;
userLoggedIn = false;
userId: string = localStorage['userId'];
+ subscription: Subscription;
constructor(private router: Router) {
};
ngOnChanges() {
- EmitterService
+ this.subscription = EmitterService
.get(this.id)
.subscribe((value) => {
if (value != null && value != '' && value != undefined && value != 'undefined') {
@@ -80,6 +84,12 @@ export class NavigationComponent implements OnInit {
];
}
+ ngOnDestroy() {
+ if (this.subscription) {
+ this.subscription.unsubscribe();
+ }
+ }
+
gotoDetail(url) {