【问题标题】:how to show tags using select2 in select tag using angularjs如何在使用angularjs的选择标签中使用select2显示标签
【发布时间】:2015-06-23 09:18:02
【问题描述】:

我想使用 select2 在下拉菜单中设置标签。就像我想放置自定义电子邮件或其他任何内容一样,它应该显示为标签。 我正在分享 jsfiddle。

<div ng-controller="MyCtrl">
    <label>Please select items:</label>
    <select ui-select2 multiple ng-model='selectedDaltons'>
        <option ng-repeat="d in daltons" ng-bind="d" value="{{ d }}"></option>
    </select>
</div>




var myApp = angular.module('myApp', ['ui.select2']);

function MyCtrl($scope) {
    $scope.daltons = [
        'Joe',
        'William' ,
        'Jack' ,
        'Averell' ,
        'Ma' 
    ];    
    $scope.selectedDaltons = 'joe'; // Averell is preselected 
};

http://jsfiddle.net/hWXBv/179/

【问题讨论】:

    标签: javascript jquery html angularjs angularjs-select2


    【解决方案1】:

    在ui-select中,你可以使用'tagging'功能,你甚至可以设置tagging-label。 看看这个链接

    https://github.com/angular-ui/ui-select/wiki/ui-select
    

    还有这个笨蛋:

    http://plnkr.co/edit/m1SQXUxftBLQtitng1f0
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-01
      • 2021-11-27
      • 2019-05-28
      • 1970-01-01
      相关资源
      最近更新 更多