Template-configration-unsubscribed from observable

Unsubscribed from subscription in template-configuration component. This
will release any resources that the subscription holds when the
component is destroyed.

Issue-ID: APPC-1049
Change-Id: Icbf3575e034a693f7357782826690d079945faa7
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
index a3d55ba..6cae746 100644
--- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
@@ -23,6 +23,7 @@
 */
 
 import { Component, Input, OnInit, ViewChild } from '@angular/core';
+import { Subscription } from 'rxjs/Subscription';
 import { HttpUtilService } from '../../../../shared/services/httpUtil/http-util.service';
 import { MappingEditorService } from '../../../../shared/services/mapping-editor.service';
 import { ArtifactRequest } from '../../../../shared/models/index';
@@ -59,7 +60,8 @@
   initialAction: any;
   public referenceData: Array<Object> = [];
   public scopeName: any;
-  public subscription: any;
+  public subscription: Subscription;
+  public templateSubscription : Subscription;
   public item: any = {};
   public goldenActions: Array<string> = [];
   public refNameObj = {};
@@ -173,7 +175,7 @@
       this.item = { "action": "", "scope": { "vnf-type": "", "vnfc-type": "" }, "vm": [], "protocol": "", "download-dg-reference": "", "user-name": "", "port-number": "", "artifact-list": [], "deviceTemplate": "", "scopeType": "" };
     }
     this.initialAction = this.item.action;
-    this.activeRoutes.url.subscribe(UrlSegment => {
+    this.subscription = this.activeRoutes.url.subscribe(UrlSegment => {
       this.actionType = UrlSegment[0].path
     })
     this.mappingEditorService.fromScreen = 'MappingScreen';
@@ -190,6 +192,9 @@
         this.mappingEditorService.changeNavDownloadData(this.downloadDataObject);
       }
     }
+
+    if(this.subscription) { this.subscription.unsubscribe(); }
+    if(this.templateSubscription) { this.templateSubscription.unsubscribe(); }
   }
   //========================== End of ngOnDestroy() Method============================================
   ngAfterViewInit() {
@@ -299,7 +304,7 @@
       let input = this.utilityService.createPayloadForRetrieve(false, this.item.action, this.vnfType, fileName);
       let artifactContent: any;
       this.ngProgress.start();
-      this.httpUtil.post({
+      this.templateSubscription = this.httpUtil.post({
         url: environment.getDesigns,
         data: input
       }).subscribe(resp => {