|
1 |
| -import { Component, OnInit, OnDestroy } from '@angular/core'; |
2 |
| -import { ActivatedRoute } from '@angular/router'; |
3 |
| -import { ApplicationService } from '../application.service'; |
| 1 | +import { Component, Inject } from '@angular/core'; |
4 | 2 | import { Application } from '../application.model';
|
5 |
| -import { Subject } from 'rxjs'; |
6 |
| -import { takeUntil } from 'rxjs/operators'; |
| 3 | +import { TAB_DATA } from '../../navigation/tab.model'; |
7 | 4 |
|
8 | 5 | @Component({
|
9 | 6 | selector: 'tim-application-launch-container',
|
10 | 7 | templateUrl: './application-launch-container.component.html',
|
11 | 8 | styleUrls: ['./application-launch-container.component.scss']
|
12 | 9 | })
|
13 |
| -export class ApplicationLaunchContainerComponent implements OnInit, OnDestroy { |
14 |
| - public application: Application; |
| 10 | +export class ApplicationLaunchContainerComponent { |
| 11 | + constructor( |
| 12 | + @Inject(TAB_DATA) |
| 13 | + public application: Application) { } |
15 | 14 |
|
16 |
| - private componetDestroyed = new Subject(); |
17 |
| - |
18 |
| - constructor(private route: ActivatedRoute, |
19 |
| - private applicationService: ApplicationService) { } |
20 |
| - |
21 |
| - public ngOnInit() { |
22 |
| - this.route.paramMap.subscribe(params => { |
23 |
| - const appId = params.get('appId'); |
24 |
| - this.applicationService.getApplication(appId) |
25 |
| - .pipe(takeUntil(this.componetDestroyed)) |
26 |
| - .subscribe(app => { |
27 |
| - this.application = app; |
28 |
| - }); |
29 |
| - }); |
30 |
| - } |
31 |
| - |
32 |
| - public ngOnDestroy() { |
33 |
| - this.componetDestroyed.next(); |
34 |
| - this.componetDestroyed.unsubscribe(); |
35 |
| - } |
36 | 15 | }
|
0 commit comments