gpt4 book ai didi

angularjs - 我应该如何在 Angular Material 中实现多重选择选项?

转载 作者:行者123 更新时间:2023-12-03 11:36:51 24 4
gpt4 key购买 nike

我检查了文档和演示,但是but!我还没有发现使用 Angular Material 实现多重选择(如select 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 supposed to implement multiple select option in angular-material?

关于angularjs - 我应该如何在 Angular Material 中实现多重选择选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28655946/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com