Mercurial > hg > ng2-query-ismi
diff app/query-select.component.ts @ 0:39ec75917ef7
first checkin
author | casties |
---|---|
date | Thu, 07 Jan 2016 15:04:15 +0100 |
parents | |
children | 59b7c3afcc6b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/query-select.component.ts Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,31 @@ +import {Component} from 'angular2/core'; + +@Component({ + selector: 'query-select', + template: ` + <p>Selected option: {{selectedQuery}}</p> + <select (change)="onSelectType($event)"> + <option *ngFor="#option of queryTypes" [value]="option"> + {{option}} + </option> + </select> + <select [(ngModel)]="selectedQuery"> + <option *ngFor="#option of query2Types" [value]="option"> + {{option}} + </option> + </select> + ` +}) +export class QuerySelectComponent { + public queryTypes = ['Object type is', 'Attribute contains']; + public selectedQuery = 'unknown'; + public query2Types = ['a', 'b', 'c']; + + onSelectType(event: any) { + var selected = event.target.value + this.selectedQuery = selected; + if (selected == 'Attribute contains') { + this.query2Types = ['d', 'e', 'f']; + } + } +}