Bug caused by #2722
Expected:
This valid template should not cause an error:
<md-select #foo><md-select>
<div *ngIf="foo.selected != null">...</div>
Actual:
Error: "Cannot read property 'selected' of undefined" because in Material's source code, _selectionModel is undefined until ngAfterContentInit:
get selected(): MdOption | MdOption[] {
return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
}
https://github.com/angular/material2/blame/cd55082a488e58a3f4948bba8e5d0a6771a57233/src/lib/select/select.ts#L411