Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
fixed binding issue of select component.
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmeshpipariya committed Jun 15, 2016
1 parent 338e98d commit dfdf087
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Select {
];
private items1: Array<string> = ['Amsterdam', 'Birmingham', 'Dortmund', 'Gothenburg', 'London', 'Seville'];
private item2: string = 'Gothenburg';
private item: any = { name: 'Dortmund', value: '3', disabled: false };
private item: any = { value: '3', name: 'Dortmund', disabled: false };
//private item: string = '3';
private item1: any = { name: 'Dortmund', value: '3' };
private change(value: any) {
Expand Down
14 changes: 1 addition & 13 deletions src/components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,7 @@ export class Md2Select implements AfterContentInit, AfterContentChecked, Control
}

ngAfterContentChecked() {
let opt = this._options.filter((o) => {
//let o1 = o.value, o2 = this.value;
//if (o.value == this.value) return true;
//if (o1 === null || o2 === null) return false;
//if (o1 !== o1 && o2 !== o2) return true;
//let t1 = typeof o1, t2 = typeof o2;
//if (t1 === t2 && t1 === 'object') {
// if (JSON.stringify(o1) === JSON.stringify(o2)) return true;
// else return false;
//}
//return false;
return this.equals(o.value, this.value);
})[0];
let opt = this._options.filter(o => this.equals(o.value, this.value))[0];
if (opt) {
this.selectedValue = document.getElementById(opt.id).innerHTML;
}
Expand Down

0 comments on commit dfdf087

Please sign in to comment.