I need to call couple of JavaScript functions (placeholder fallback etc) on AngularJS view change. How can I achieve this globally?
2 Answers
Instead of adding the following $scope.on you can also add a custom function using ng-init when the controller is called (new view state).
HTML:
<div class="container-fluid" ng-controller="home-services" ng-init="init()">
--- Code ---
</div>
ANGULARJS:
angular.module('home').controller('home-services', function($scope){
$scope.init = function(){
---- Your Javascript ----
};
});