Question

I'm building little bit bigger aplication in angular and I have problem with only one controller, they are all same, but this one is always undefined. Module is loaded because otherwise angular will crash.

My app structure looks like this...

angular.module("myAPP", [
 "ui.router",
 "ui.bootstrap",
 "ngSanitize",
 "ngAnimate",
 "templates",
 "factories",
 "filters",
 "myAPP.actions",
 "myAPP.users",
 "myAPP.pages",
 "myAPP.index",
 "myAPP.categories",
 "myAPP.packages",
 "myAPP.shops",
 "myAPP.stats" 
])

And child modules looks same:

angular.module("myAPP.actions",  [
 "myAPP.actions.detail",
 "myAPP.actions.new",
 "myAPP.actions.list",
 "myAPP.actions.edit"
])
.controller("ActionsCtrl",
(
 $scope,
 titleService
) ->
 titleService.setTitle "Actions"
)

And I'm getting

Error: [ng:areq] Argument 'ActionsCtrl' is not a function, got undefined

So I try to invokeQueue

queue = angular.module("koukejakupuj.actions")._invokeQueue
console.log(queue)

and it looks like controller is loaded:

[Array[3]]
 0: Array[3]
  0: "$controllerProvider"
  1: "register"
  2: Arguments[2]
   0: "ActionsCtrl"
   1: function ($scope, titleService) {...

I cant figure out where could be problem.

//EDIT: Code is in coffeescript!

Was it helpful?

Solution 2

Finally figured out after two days.

After refactoring I forget to remove file with controller with same name, pretty awful fail/error.

OTHER TIPS

Try this:-

angular.module("myAPP.actions",  [
"myAPP.actions.detail",
"myAPP.actions.new",
"myAPP.actions.list",
"myAPP.actions.edit"
])
.controller("ActionsCtrl",function( $scope, titleService) {
// your controller code here.
}
);

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top