Skip to content

Commit 5c5351f

Browse files
committed
Address the feedback.
1 parent 0bf1f1d commit 5c5351f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/lib/select/select.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('MdSelect', () => {
1616
beforeEach(async(() => {
1717
TestBed.configureTestingModule({
1818
imports: [MdSelectModule.forRoot(), ReactiveFormsModule, FormsModule],
19-
declarations: [BasicSelect, NgModelSelect, ManySelects, NgIfSelect, SelectWithoutOptions],
19+
declarations: [BasicSelect, NgModelSelect, ManySelects, NgIfSelect, SelectInitWithoutOptions],
2020
providers: [
2121
{provide: OverlayContainer, useFactory: () => {
2222
overlayContainerElement = document.createElement('div') as HTMLElement;
@@ -241,7 +241,7 @@ describe('MdSelect', () => {
241241

242242
it('should select the proper option when the list of options is initialized at a later point',
243243
async(() => {
244-
let fixture = TestBed.createComponent(SelectWithoutOptions);
244+
let fixture = TestBed.createComponent(SelectInitWithoutOptions);
245245
let instance = fixture.componentInstance;
246246

247247
fixture.detectChanges();
@@ -1257,7 +1257,7 @@ class NgIfSelect {
12571257

12581258

12591259
@Component({
1260-
selector: 'ng-if-select',
1260+
selector: 'select-init-without-options',
12611261
template: `
12621262
<md-select placeholder="Food I want to eat right now" [formControl]="control">
12631263
<md-option *ngFor="let food of foods" [value]="food.value">
@@ -1266,7 +1266,7 @@ class NgIfSelect {
12661266
</md-select>
12671267
`
12681268
})
1269-
class SelectWithoutOptions {
1269+
class SelectInitWithoutOptions {
12701270
foods: any[];
12711271
control = new FormControl('pizza-1');
12721272

src/lib/select/select.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
234234
this._resetOptions();
235235

236236
if (this._control) {
237-
// Defer setting the value in order to avoid the "Expression has changed after
238-
// it was checked" errors from Angular.
239-
Promise.resolve(null).then(() => this.writeValue(this._control.value));
237+
// Defer setting the value in order to avoid the "Expression
238+
// has changed after it was checked" errors from Angular.
239+
Promise.resolve(null).then(() => this._setSelectionByValue(this._control.value));
240240
}
241241
});
242242
}

0 commit comments

Comments
 (0)