I get the following error when adding a directive to my site:
Error: [ng:areq] Argument \'MainController\' is not a function, got undefined
The
You are redefining the module. Define module only once.
when used as angular.module('my-app', [])
it defined the module this should be used only once. When you want retrieve it. then use angular.module('my-app')
Use
angular.module('my-app') //Notice remove []
.directive("welcome", function() {
});
passing a 2nd argument like this angular.module('my-app', [])
creates a new module, use it only once.
To retrive a module use var module = angular.module('my-app')
and use module.controller(...
or module.directive(....
etc.,