diff options
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.component.ts')
-rw-r--r-- | vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.component.ts | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.component.ts new file mode 100644 index 000000000..c69ab52e1 --- /dev/null +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/component-info/component-info.component.ts @@ -0,0 +1,40 @@ +import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core'; +import {ComponentInfoService} from "./component-info.service"; +import {ComponentInfoModel, ComponentInfoType} from "./component-info-model"; +import {ActivatedRoute} from "@angular/router"; + + +@Component({ + selector: 'component-info', + templateUrl: './component-info.component.html', + styleUrls: ['./component-info.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class ComponentInfoComponent implements OnInit { + componentInfoModel: ComponentInfoModel = null; + + constructor(private _componentInfoService:ComponentInfoService, private route: ActivatedRoute) {} + + ngOnInit() { + ComponentInfoService.triggerComponentInfoChange.subscribe((input : ComponentInfoModel) => { + if(input.type === ComponentInfoType.SERVICE){ + this.getServiceInformation(); + }else { + this.componentInfoModel = input; + } + }); + + this.getServiceInformation(); + } + + + + getServiceInformation() : void { + this.route + .queryParams + .subscribe(params => { + let serviceModelId = params['serviceModelId']; + this.componentInfoModel = this._componentInfoService.getInfoForService(serviceModelId); + }); + } +} |