我想显示一个模式框,询问用户是否要删除帖子。我不知道如何传递我在 key 参数中传递的密钥,我也可以在其中发出警报。
我从 angular 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');
};
};