angular - Errror Can't bind to 'ngModel' since it isn't a known property of 'md-select' -
i have error while i'm integrating select component in material design2
can't bind 'ngmodel' since isn't known property of 'md-select'.
template:
<md-select placeholder="favorite food" [(ngmodel)]="selectedvalue" name="food"> <md-option *ngfor="let food of foods" [value]="food.value"> {{food.viewvalue}} </md-option> </md-select> component code
.... selectedvalue: string; foods = [ {value: 'steak-0', viewvalue: 'steak'}, {value: 'pizza-1', viewvalue: 'pizza'}, {value: 'tacos-2', viewvalue: 'tacos'} ]; ..... and select imported in module indicated in documentation.
any ideas how can fix ?
you need add formsmodule in appmodule or other module imports entry using <md-select>. also, remove materialmodule imports, depreciated.
import { formsmodule } '@angular/forms'; .... imports: [ formsmodule ]
Comments
Post a Comment