Skip to content

Commit

Permalink
Address the feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto committed Jan 4, 2017
1 parent 2f2cc8e commit 7506973
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/lib/select/select.spec.ts
Expand Up @@ -16,7 +16,7 @@ describe('MdSelect', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdSelectModule.forRoot(), ReactiveFormsModule, FormsModule],
declarations: [BasicSelect, NgModelSelect, ManySelects, NgIfSelect, SelectWithoutOptions],
declarations: [BasicSelect, NgModelSelect, ManySelects, NgIfSelect, SelectInitWithoutOptions],
providers: [
{provide: OverlayContainer, useFactory: () => {
overlayContainerElement = document.createElement('div') as HTMLElement;
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('MdSelect', () => {

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

fixture.detectChanges();
Expand Down Expand Up @@ -1256,7 +1256,7 @@ class NgIfSelect {


@Component({
selector: 'ng-if-select',
selector: 'select-init-without-options',
template: `
<md-select placeholder="Food I want to eat right now" [formControl]="control">
<md-option *ngFor="let food of foods" [value]="food.value">
Expand All @@ -1265,7 +1265,7 @@ class NgIfSelect {
</md-select>
`
})
class SelectWithoutOptions {
class SelectInitWithoutOptions {
foods: any[];
control = new FormControl('pizza-1');

Expand Down
6 changes: 3 additions & 3 deletions src/lib/select/select.ts
Expand Up @@ -234,9 +234,9 @@ export class MdSelect implements AfterContentInit, ControlValueAccessor, OnDestr
this._resetOptions();

if (this._control) {
// Defer setting the value in order to avoid the "Expression has changed after
// it was checked" errors from Angular.
Promise.resolve(null).then(() => this.writeValue(this._control.value));
// Defer setting the value in order to avoid the "Expression
// has changed after it was checked" errors from Angular.
Promise.resolve(null).then(() => this._setSelectionByValue(this._control.value));
}
});
}
Expand Down

0 comments on commit 7506973

Please sign in to comment.