Angular factories in a separate files?

692 views
Skip to first unread message

Claus Fjellø-Jensen

unread,
Nov 12, 2012, 7:49:18 AM11/12/12
to ang...@googlegroups.com
Hi, 

I am having trouble with the infamous Unknown provider error when trying to put factory services in separate files.
Whatever real error that is causing this seems to get buried within the Angularjs framework.

I have two small example factories that works when put in the same file as the controller, but fails when put in separate js-files.

The following Plunker illustrates this (hopefully shared, otherwise let me know):


Br,
Claus

Peter Bacon Darwin

unread,
Nov 12, 2012, 1:47:51 PM11/12/12
to ang...@googlegroups.com
This Plnkr seems to work.  Can you describe how to reproduce the problem with it?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en.
 
 

Claus Fjellø-Jensen

unread,
Nov 12, 2012, 4:52:05 PM11/12/12
to ang...@googlegroups.com
This is weird - when I wrote this example earlier today, I produced an error whenever I commented out the the two factory methods in the main file (app.js) and forced it to use the factory1.js and factory02.js files instead, but you are absolutely right, it works ... Maybe I did not refresh everything correctly.

Anyway, thanks for taking the time to have a look!

Br,
Claus
Reply all
Reply to author
Forward
0 new messages