Problem injecting controller for testing

111 views
Skip to first unread message

Kim Andre Pettersen

unread,
Feb 21, 2013, 3:26:34 PM2/21/13
to ang...@googlegroups.com
Hello!

I've struggled with injecting controllers and using them in my tests for a couple of days now, and I wonder if someone here could help me out.

I have tried to inject the controller in a few different ways, but I always get an empty object {}. I get an error if I try to create a controller that doesn't exist, so it should have access to the controller.

The problems are explained a bit better here http://jsfiddle.net/kimpettersen/tLAW5/13/

Kim

Peter Bacon Darwin

unread,
Feb 21, 2013, 3:30:03 PM2/21/13
to ang...@googlegroups.com
Hi Kim
You are trying to call changeView on the controller but it is actually defined on the scope.
Try scope.changeView instead
Pete




Kim

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Kim Andre Pettersen

unread,
Feb 21, 2013, 3:45:58 PM2/21/13
to ang...@googlegroups.com
You're right! That made me understand scope a lot better, and it totally makes sense. 

This made me happy, thank you very much!

Kim

Peter Bacon Darwin

unread,
Feb 21, 2013, 3:49:45 PM2/21/13
to ang...@googlegroups.com
You're welcome!


--
Reply all
Reply to author
Forward
0 new messages