2014-09-22 63 views
0

我想使用這個模塊:https://github.com/angular-ui/ui-select前值不會顯示在角UI-選擇

我使用多選選項。我從api獲取值,並將它們顯示爲選擇框的選項。

但它不顯示以前選擇的選項,即使當我使用console.log($ scope.modalPrivacyGroups.selected)它最初顯示了上一個選定的值,一段時間後它變空了!

我的HTML:

<ui-select id="privacyUsers" multiple ng-model="modalPrivacyUsers.selected" theme="bootstrap" 
          ng-disabled="disabled" 
          style="width: 100%;"> 
        <ui-select-match placeholder="Select users"> 
         {{$item.full_name}} 
        </ui-select-match> 
        <ui-select-choices repeat="user in allUsers | filter:$select.search"> 
         {{user.full_name + ' &lt;' + user.email+ '&gt;'}} 
        </ui-select-choices> 
</ui-select> 

我的角度JS代碼:

var CustomPrivacyCtrl = function ($scope, $modal, $modalInstance, Auth, User, Group) { 
    $scope.modalPrivacyUsers = {}; 
    $scope.modalPrivacyUsers.selected = []; 
    $scope.modalPrivacyGroups = {}; 
    $scope.modalPrivacyGroups.selected = []; 
    $scope.allUsers = User.query(); 

    $scope.modalPrivacyUsers.selected = $scope.$parent.tweet.privacyUsers; 
} 

將巨大的,如果任何人都可以作出正確或給我一個SOLU

回答

0

這裏是一個簡化版本的原始代碼,因爲您的代碼的一部分特定於您的業務模型。 [plnkr]1