1 import { Component, Input } from "@angular/core";
3 import { ISdk, SdkService } from "../services/sdk.service";
6 selector: 'sdk-select-dropdown',
8 <div class="btn-group" dropdown *ngIf="curSdk" >
9 <button dropdownToggle type="button" class="btn btn-primary dropdown-toggle" style="width: 20em;">
10 {{curSdk.name}} <span class="caret" style="float: right; margin-top: 8px;"></span>
12 <ul *dropdownMenu class="dropdown-menu" role="menu">
13 <li role="menuitem"><a class="dropdown-item" *ngFor="let sdk of sdks" (click)="select(sdk)">
20 export class SdkSelectDropdownComponent {
22 // FIXME investigate to understand why not working with sdks as input
23 // <sdk-select-dropdown [sdks]="(sdks$ | async)"></sdk-select-dropdown>
24 //@Input() sdks: ISdk[];
29 constructor(private sdkSvr: SdkService) { }
32 this.curSdk = this.sdkSvr.getCurrent();
33 this.sdkSvr.Sdks$.subscribe((s) => {
36 if (this.curSdk === null || s.indexOf(this.curSdk) === -1) {
37 this.sdkSvr.setCurrent(this.curSdk = s.length ? s[0] : null);
44 this.sdkSvr.setCurrent(this.curSdk = s);