Argument 'HeaderCtrl' is not a function, got undefined

1,657 views
Skip to first unread message

Yannick Chartois

unread,
May 19, 2014, 1:51:52 AM5/19/14
to ang...@googlegroups.com
Hi Guys,

I'm really stuck, I tried almost every thing and read lot of post regarding this issue but I can't figure out what I'm doing wrong...

You can find the description and the code here:
http://stackoverflow.com/questions/23606723/argument-headerctrl-is-not-a-function-got-undefined?answertab=active#tab-top

In the example it's a controller with a service, but I tried with a 'blank' controller and I got the same result...

The only difference I see with most of the examples is my files structure. Because I'm doing a big app, every controller have their own file. To be sure that all the module are created before calling them in an other file I load my app.js and a module.js (where I defined my service module, and later my directive module ) at first in my karma.conf.js.

I can test my services without problem, with $injector.

I'm using angular 1.3.0-beta.8.

Thx in advance for your help!

If needed I can fork my app, simplify it and made it public on github.

Yannick

Garry Taylor

unread,
May 19, 2014, 6:39:24 AM5/19/14
to ang...@googlegroups.com
Is this working in the Browser

Filipe Monteiro

unread,
May 19, 2014, 7:58:49 AM5/19/14
to ang...@googlegroups.com
Please, could you put some part of the code on github? So we can test it.

Yannick Chartois

unread,
May 19, 2014, 8:23:35 AM5/19/14
to ang...@googlegroups.com
Yes Garry, all is working fine in the browser.

Ok Filipe, I will put some part of the code this evening on Github


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/wQWTJeLb0_U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Filipe Monteiro

unread,
May 19, 2014, 8:28:56 AM5/19/14
to ang...@googlegroups.com
Nice!

Garry Taylor

unread,
May 19, 2014, 9:00:09 AM5/19/14
to ang...@googlegroups.com
You say that you have your controllers loaded into separate files. Where is the location of the controllers. Looking at the example on StackOverflow this appears to be in the /Scripts/ folder however Karma is only loading app/modules from this location.. 

Regards,

Garry Taylor 

Yannick Chartois

unread,
May 20, 2014, 4:46:43 AM5/20/14
to ang...@googlegroups.com
@Filipe: sorry it took more time than expected, here is the repo: https://github.com/ychartois/HelpMeApp

it works with grunt/bower/node, if you already have those tools installed you just have to clone it, go in the project/ folder and:
- npm install
- grunt test

@Garry: you have all the folder hierarchy on the repo :)

Preparing that fake project I notice something weird, if I remove the  test/ui/unit/core/services/core.js it's worst.... oO I wil investigate that a bit more, but any suggestion is welcome !!!

Thx for your help guys :)

Yannick

PS: the weird organisation of the files come from the fact that my app is a Play! framework/AngularJS app, and I organise the file to regroup some conf files...



--

Yannick Chartois

unread,
May 20, 2014, 6:04:36 AM5/20/14
to ang...@googlegroups.com
It's OK now, I understand what I did...

I didn't encapsulate my services test beforeEach in a describe function... so it hide the real problem: I didn't add all the dependencies in my karma.conf.js...

I will describe it in my post on stackOverflow ;) Thx for your questions guys, it help me to figure out the solution!!

Yannick

Filipe Monteiro

unread,
May 20, 2014, 9:07:26 AM5/20/14
to ang...@googlegroups.com
I'm glad you solved the problem!
Reply all
Reply to author
Forward
0 new messages