2014-12-02 100 views
0
<select multiple ng-multiple="true" class="form-control 
    emailReminder width-169" ng-if="checked" ng-model="selectedReminder" 
    ng-options="x as x.title for x in emailReminderList" value="{{x.id}}"> 
</select> 

我無法擺脫列表中選定值angularjs在controller.js 請建議代碼即可獲得所選擇的數組值將其推入新的數組提交頁面時angularjs列表框中的值選擇

+0

你試過這麼發R' – 2014-12-02 04:10:22

+0

2014-12-02 04:29:33

+0

我想用這個$ scope.saveReminder = function(){ 調試器; var list = []; // var selected = $('#idSelect option:selected'); var selected = document.getElementById('idSelect');對於(var i = 0; i 2014-12-02 04:30:04

回答

1

的Html

<select multiple="multiple" id="idSelect" class="form-control emailReminder width-169" 
    ng-if="checked" ng-model="selectedReminder" 
    ng-options="x as x.title for x in emailReminderList"> 
</select> 

在控制器

$scope.saveReminder = function() { 
    angular.forEach($scope.selectedReminder, function($value, $key) { 
     $scope.list.push($value.title); 
    }); 
    console.log($scope.list); 
}; 
+0

下一次,花點時間格式化答案。 – 2014-12-02 06:12:04

+0

嗨試圖使用這個,但沒有得到$控制器上的價值 – 2014-12-02 07:04:19

+0

HI PLZ發佈JSon格式 – Kiran 2014-12-03 08:55:23