简体   繁体   English

角材料选择和复选框

[英]Angular material select and checkbox

Im trying to get multiselect by placing checkbox inside select option. 我试图通过在选择选项内放置复选框来获得多选。 if this is my html code... 如果这是我的html代码...

<md-input-container>
  <md-select ng-model="clients.regions" placeholder="Select a regions">
    <md-option ng-repeat="data in regions">
      <md-checkbox  ng-model="clients.regions">
         {{ data }}
    </md-checkbox>
  </md-option>
</md-select>
</md-input-container>

      <pre>selected: {{clients.regions}}</pre>

from controller im getting regions ... 从控制器即时获取区域...

  $http.get('/api/v1/secure/lov/regions').success(function(response) {
    $scope.regions=response.values;
  });

Regions is an array ... i got no idea how to store and edit with select options with checkbox inside ... 区域是一个数组...我不知道如何使用带有复选框的选择选项来存储和编辑...

    regions : [{ type: String, trim: true, required: true }],

If there is any easy way ...Do help .. thanks in advance 如果有任何简单的方法...请帮助.. 在此先感谢

I have never seen what you describe, it is probably impossible. 我从未见过您的描述,这可能是不可能的。 The regular way to do it is to have tags added thanks to an autocomplete input text. 常规方法是通过自动完成输入文本来添加标签。 You can build your own with datalist , or use this angular-tagger project 您可以使用datalist构建自己的数据库,也可以使用此angular-tagger项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM