I do not understand why the expression "{{isMultiple}}" is not evaluated in this code:
HTML:
<md-input-container style="width: 30%;">
<label>{{label}}</label>
<md-select ng-model="choice" multiple="{{isMultiple}}">
<md-option value="1">Option 1</md-option>
<md-option value="2">Option 2</md-option>
<md-option value="3">Option 3</md-option>
</md-select>
</md-input-container>
JS:
angular.module('app', ['ngMaterial'])
.controller('AppCtrl', AppCtrl);
function AppCtrl($scope) {
$scope.isMultiple = false;
$scope.choice = "";
$scope.label = "MyLabel";
}
Full code on Plunker: https://plnkr.co/edit/a5yCLW?p=preview
The Dropdown control should NOT be multi-selectable in this example.
well if you could do
multiple="false"
then you won't get checkboxes but it work quiet simple user can select only one value as expected. checkbox means there could be more then one selection could be made.
It is not possible to pass an expression to the attribute
multiple
, according to the documentation:However, one way around this is to create the
md-select
in the code - CodePenMarkup
JS