我想顯示一個模式框,詢問用戶是否要刪除帖子。我無法弄清楚如何傳遞我在關鍵論證中傳遞的關鍵信息,我也可以提醒。將數據傳遞給Twitter Bootstrap Modal中的角度
我從角twitterbootstrap網站的代碼,但我不知道一種方法來傳遞數據,以確認刪除。
感謝 穆罕默德
$scope.deletePost = function(key, post, event) {
alert(key);
var modalInstance = $modal.open({
templateUrl: 'deletePost.html',
controller: ModalInstanceCtrl,
resolve: {
items: function() {
return $scope.posts;
}
},
})
modalInstance.result.then(function(selectedItem) {
$scope.selected = selectedItem;
alert(selectedItem);
});
};
var ModalInstanceCtrl = function($scope, $modalInstance, items) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function() {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
感謝那就是我正在尋找的東西,將密鑰傳遞給模態控制器 –