我已经检查了文档和演示文稿,但唉!我没有找到任何实施多选择选项的参考,如使用角材料的选择2.
有人可以告诉我如何使它工作?
有人可以告诉我如何使它工作?
Splaktar的答案是正确的:只需添加多个到您的md-select.
Codepen工作解决方案:http://codepen.io/ansgar-john/pen/RWPVEO?editors=101
HTML
<div> <md-input-container> <md-select multiple ng-model="ctrl.likedAnimals" placeholder="please select"> <md-option ng-repeat="a in ctrl.animals" value="{{a}}">{{a}}</md-option> </md-select> </md-input-container> </div>
JS
(function () { 'use strict'; angular .module('MyApp') .controller('AppCtrl',function($scope) { this.likedAnimals = ["mouse","dog"]; this.animals = ["mouse","dog","cat","bird"]; }); })();
基于堆栈溢出的代码答案:How am I suppose to implement multiple select option in angular-material?