Mercurial > hg > ng2-query-ismi
comparison app/query-select.component.ts @ 3:c741a00d38de
first list of object types :-)
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 13 Jan 2016 12:41:01 +0100 |
parents | 59b7c3afcc6b |
children | 351c3df28602 |
comparison
equal
deleted
inserted
replaced
2:80270f5a5735 | 3:c741a00d38de |
---|---|
7 | 7 |
8 @Component({ | 8 @Component({ |
9 selector: 'query-select', | 9 selector: 'query-select', |
10 template: ` | 10 template: ` |
11 <p>Selected option: {{selectedQuery}}</p> | 11 <p>Selected option: {{selectedQuery}}</p> |
12 <select (change)="onSelectType($event)"> | 12 <select (change)="onSelectMode($event)"> |
13 <option *ngFor="#mode of queryModes" [value]="mode.id"> | 13 <option *ngFor="#mode of queryModes" [value]="mode.id"> |
14 {{mode.label}} | 14 {{mode.label}} |
15 </option> | 15 </option> |
16 </select> | 16 </select> |
17 <select [(ngModel)]="selectedQuery"> | 17 <select [(ngModel)]="selectedQuery"> |
34 this.setupQueryModes(); | 34 this.setupQueryModes(); |
35 } | 35 } |
36 | 36 |
37 setupQueryModes() { | 37 setupQueryModes() { |
38 this.queryModes = this._queryService.getQueryModes(); | 38 this.queryModes = this._queryService.getQueryModes(); |
39 this._queryService.getIsmiObjectTypes(); | 39 this._queryService.setupIsmiObjectTypes(); |
40 } | 40 } |
41 | 41 |
42 onSelectType(event: any) { | 42 onSelectMode(event: any) { |
43 var selected = event.target.value; | 43 var selected = event.target.value; |
44 this._queryService.getQueryOptions(selected).then( | 44 var mode = this.queryModes.find(mode => mode.id === selected); |
45 this._queryService.getQueryOptions(mode).then( | |
45 options => this.query2Options = options); | 46 options => this.query2Options = options); |
46 } | 47 } |
47 } | 48 } |