小编Ale*_*min的帖子

AngularJS和UI-选择多个数据

下午好!

我正在尝试使用UI-Select来填充与模型相关联的表单.使用控制器通过以下方式从服务器接收模型数据:

<form action="index.php" method="post" class="form-horizontal" ng-controller="WorkPlanController as ctrl" ng-init="init(6)">

<!-- this work perfectly! -->
    <textarea name="workplan_approver_post" ng-model="workplan.approver_post"></textarea>

<!-- here I have troubled -->
<div ng-controller="LookupController as lookupCtrl" ng-init="lookupCtrl.initLookup('corriculum_speciality_directions')">
<ui-select ng-disabled="disabled" multiple ng-model="workplan.profiles" theme="select2">
<ui-select-match placeholder="???????? ???????? ?? ??????">{{$item.value}}</ui-select-match>
<ui-select-choices repeat="item.key as item in items track by $index | filter: $select.search">
<div ng-bind-html="item.value | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>

</form>
Run Code Online (Sandbox Code Playgroud)

WorkPlanController是一个简单的REST服务:

application
    .controller("WorkPlanController", [
        '$scope',
        'WorkPlan',
    function($scope, workPlanFactory){
        $scope.workplan;
        $scope.workplan = {
            profiles: []
        };
        $scope.init = function($id){
            workPlanFactory.get({id: $id}, …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angularjs-ng-repeat ui-select2

5
推荐指数
1
解决办法
1635
查看次数