點擊這裏查看我的代碼: http://plnkr.co/edit/Z7QI9Ec53zfkDylnseAc?p=preview顯示模式時複選框被選中或取消
HTML:
<ul>
<li ng-repeat="album in albums">
<input type="checkbox" ng-model="album.selected" value={{album.name}} ng-click="save()"/> {{album.name}}
</li>
腳本:
$scope.save = function(item){
$scope.mods = item;
$scope.albumNameArray = [];
angular.forEach($scope.albums, function(album){
if (album.selected) $scope.albumNameArray.push(album.name);
return false;
});
};
$scope.edit = function(){
if ($scope.albumNameArray) {
$('#showModal').modal('show');
} else {
$('#showModal2').modal('show');
}
}
我的項目是工作很好,如果我點擊保存按鈕沒有選中複選框,但我f我檢查並取消選中,同樣的模態出現。 這隻適用於第一次重新加載。 我想說的是,如果我選中該複選框,確定模式會顯示其他另一種模式將顯示無需重新加載
請提供更多的信息(代碼)。 –
謝謝你的回覆:) heres我的plnkr:http://plnkr.co/edit/Z7QI9Ec53zfkDylnseAc?p=info – x44