Revision 59816
Added by Argiro Kokogiannaki over 3 years ago
sideBar.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input, OnInit} from '@angular/core'; |
2 |
import {RootMenuItem, SideMenuItem} from '../menu';
|
|
2 |
import {SideMenuItem} from '../menu'; |
|
3 | 3 |
import {ActivatedRoute, Router} from '@angular/router'; |
4 |
import {Observable} from 'rxjs/Observable';
|
|
4 |
import {Subscriber} from "rxjs";
|
|
5 | 5 |
|
6 | 6 |
@Component({ |
7 | 7 |
selector: 'sidebar', |
... | ... | |
11 | 11 |
@Input() communityId: string = ''; |
12 | 12 |
@Input() menuItems: SideMenuItem[] = []; |
13 | 13 |
currentParams: any = {}; |
14 |
|
|
14 |
sub; |
|
15 | 15 |
constructor(private router: Router, |
16 | 16 |
private route: ActivatedRoute) { |
17 | 17 |
} |
18 |
|
|
18 |
ngOnDestroy() { |
|
19 |
if (this.sub instanceof Subscriber) { |
|
20 |
this.sub.unsubscribe(); |
|
21 |
} |
|
22 |
} |
|
19 | 23 |
ngOnInit(): void { |
20 |
this.route.queryParams.subscribe(params => { |
|
24 |
this.sub = this.route.queryParams.subscribe(params => {
|
|
21 | 25 |
this.currentParams = params; |
22 | 26 |
}); |
23 | 27 |
} |
Also available in: Unified diff
[Library|Trunk]
code clean up:
-remove app.* files from library
-remove unused imports, code, files (Old search pages for results, dataproviders, map search page, etc)
-remove Freeguard from modules
-unsubscribe all subscriptions
-Services: configuration, isvocabularies, user management: unsubscribe from app component or the component that uses them (clearSubscriptions())
-Fetchers: unsubscribe from the component that uses them (clearSubscriptions())