[Solved] Why alert window not displayed?


You need to inject the dependency $window as follows

app.controller('MainCtrl', function($scope,$window) {

   $scope.fireOnExpand = function(){
     $window.alert("eee");
  }
});

Here is a demo

Alternatively, just use alert('eee');

$scope.fireOnExpand = function(){
     alert("eee");
  }

Here is a demo

P.S.

The main reason your alert window wasn’t being displayed after adding $window is, because the button was out of the scope of the ng-controller.

Here is the correctly working code

6

solved Why alert window not displayed?