Reputation: 9819
angular.module('myApp')
.controller('pancakeController', ['$scope', '$window', function($scope, $window) {
$scope.panCakes = [];
$scope.removePancake = function(index) {
if($window.confirm('are you sure?')) {
$scope.panCakes.splice(index, 1);
} else {
$scope.panCakes.splice(index, 1);
}
};
}]);
myApp
is already defined in another file. I'm using angular.module('myApp')
to grab a reference to it.
Trying to use window.confirm()
to confirm the user before deleting a panCake but the confrim box does not popup in Chrome 37.0.2062.94 but does work in Chrome Canary.
I'm using the AngularJS $window object, but using regular window.confirm does not work either. Is there something that I'm missing in my code or is just a bug in that particular version of Chrome?
Upvotes: 3
Views: 8646
Reputation: 7666
I am working on the same version of chrome as you are and the above code was not working in the fiddle as you had syntax error in the definition of the angular.module
It should be
angular.module('myApp',[])
Instead of
angular.module('myApp')
Upvotes: 0
Reputation: 48212
The most probable cause is that you have at some point checked the little checkbox saying that you don't want to see any more alerts/confirms/prompts from this page.
(Among other solutions, closing the tab and reopening the page in a new tab should restore alerts/confirms/prompts.)
Upvotes: 11