AngularJS $ window.confirm not working in Chrome
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
already defined in another file. I am using angular.module('myApp')
to get a link to it.
Trying to use window.confirm()
panCake to validate user before deleting file but confrim field doesn't appear in Chrome 37.0.2062.94 but works in Chrome Canary. I am using AngularJS $ window object, but using regular window.confirm doesn't work either. Is there something I'm missing in my code or just a bug in this particular version of Chrome?
The most likely reason is that at some point you checked the little checkbox that says you don't want to see more warnings / confirmations / prompts from this page.
<sub> (Among other solutions, closing a tab and reopening the page in a new tab should restore warnings / confirmations / prompts.) Sub>
I am working on the same chrome version as you and the above code did not work in the script as you had a syntax error in your angular.module definition
It should be
angular.module('myApp',[])
Instead
angular.module('myApp')
Working script