0

I was reading the docs on angular 1.3, was this controller syntax removed?? do I now have to use

var app = module("myModule", []); 
app.controller("AppCtrl", function(){});
Jesse
  • 785
  • 2
  • 9
  • 29
  • 1
    Yes it now needs configuration to support it. See this:- http://stackoverflow.com/questions/25111831/controller-not-a-function-got-undefined-while-defining-controllers-globally/25111942#25111942 – PSL Oct 22 '14 at 18:58

1 Answers1

0

In Angular 1.3 this syntax was removed. The reason for that is to enforce the user to use Getters instead of a settetrs.

Setter(you are setting the module):

 angular.module('app', []); 

Getter - you are getting the module

angular.module('app');

so when assigning the setter module to a variable you are always calling to the setter method which may cause variable collisions and leaks. And it makes your code much less cleaner.

As long as you will stick to the 1 component per file there should no be a problem to use the following syntax:

angular
  .module('app')
  .controller('SomeController' , function(){});
Dima Grossman
  • 2,800
  • 2
  • 21
  • 26