我使用$ mdDialog显示弹出警报。每当我关闭弹出容器时,我想刷新页面。
$scope.updateCustomer = function(){
HomeService.updateCustomer($scope.update)
.then (function success(response){
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.textContent("Username has been changed successfully!")
.ariaLabel('')
.ok('Ok')
);
},
function error(response){
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.textContent("Something is wrong!")
.ariaLabel('')
.ok('Ok')
);
});
}
关闭弹出式容器时如何刷新页面?
答案 0 :(得分:1)
这是我的问题的工作答案......
$scope.updateCustomer = function(){
HomeService.updateCustomer($scope.update)
.then (function success(response){
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.textContent("Username has been changed successfully!")
.ariaLabel('')
.ok('Ok')
.onRemoving(window.location.reload())
);
},
function error(response){
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.textContent("Something is wrong!")
.ariaLabel('')
.ok('Ok')
);
});
}
答案 1 :(得分:0)
页面重新加载并不是angularjs模式,但您可以使用:
$mdDialog
.show({
...
onRemoving: function() {
window.location.reload();
}
});