Allowing global functions as controllers in angularjs

Did you upgrade your angular app recently from v1.2 to v1.3 and you have global functions as controllers in your application? Then be ready to see your app breaking. Angular 1.3 no more supports global functions as controllers by default. You need explicitly configure your module to do that.

To allow global functions as controllers in angular 1.3 set allowGlobals property on $controllerProvider service as shown
















var app=angular.module('app',[]);
     
app.config(function($controllerProvider){

 $controllerProvider.allowGlobals();

});
  

Comments

Popular Posts