diff --git a/src/app/components/select/select.ts b/src/app/components/select/select.ts index 801afdbc4..dabb0f925 100644 --- a/src/app/components/select/select.ts +++ b/src/app/components/select/select.ts @@ -37,7 +37,7 @@ export class Select { ]; private items1: Array = ['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) { diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 43d979ac5..bc9e81d23 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -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; }