import { Component, Input } from "@angular/core"; import { ISdk, SdkService } from "../common/sdk.service"; @Component({ selector: 'sdk-select-dropdown', template: `
` }) export class SdkSelectDropdownComponent { // FIXME investigate to understand why not working with sdks as input // //@Input() sdks: ISdk[]; sdks: ISdk[]; curSdk: ISdk; constructor(private sdkSvr: SdkService) { } ngOnInit() { this.sdkSvr.Sdks$.subscribe((s) => { this.sdks = s; this.curSdk = this.sdks.length ? this.sdks[0] : null; this.sdkSvr.setCurrent(this.curSdk); }); } select(s) { this.sdkSvr.setCurrent(this.curSdk = s); } }