angularjs – 我应该如何在角质材料中实现多个选择选项?

前端之家收集整理的这篇文章主要介绍了angularjs – 我应该如何在角质材料中实现多个选择选项?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经检查了文档和演示文稿,但唉!我没有找到任何实施多选择选项的参考,如使用角材料的选择2.
有人可以告诉我如何使它工作?
Splaktar的答案是正确的:只需添加多个到您的md-select.

Codepen工作解决方案:http://codepen.io/ansgar-john/pen/RWPVEO?editors=101

HTML

  1. <div>
  2. <md-input-container>
  3. <md-select multiple ng-model="ctrl.likedAnimals" placeholder="please select">
  4. <md-option ng-repeat="a in ctrl.animals" value="{{a}}">{{a}}</md-option>
  5. </md-select>
  6. </md-input-container>
  7. </div>

JS

  1. (function () {
  2. 'use strict';
  3. angular
  4. .module('MyApp')
  5. .controller('AppCtrl',function($scope) {
  6. this.likedAnimals = ["mouse","dog"];
  7. this.animals = ["mouse","dog","cat","bird"];
  8. });
  9. })();

基于堆栈溢出的代码答案:How am I suppose to implement multiple select option in angular-material?

猜你在找的Angularjs相关文章