angular.element(el).injector() is undefined when using ng-view and router

909 views
Skip to first unread message

H.R.

unread,
Sep 19, 2014, 5:24:26 AM9/19/14
to ang...@googlegroups.com
Hello all,

I have been using angular.element(el).injector() to debug my service (as factory) from the browser console. This has worked fine.

Yesterday, I decided to split my views using ng-view and the router and since then injector() is returning undefined.
I tried targeting the the element with ng-controller as well as the element with ng-app but I still get undefined.

Can anyone help? 

Thanks.

H.R.

unread,
Sep 23, 2014, 12:00:05 AM9/23/14
to ang...@googlegroups.com
It seems like this would be a common thing people try to do. Unfortunately, I haven’t found anybody posting about this issue on forums.

Has anyone had this problem?

Thanks.
Message has been deleted

Leslie Lip

unread,
Jan 28, 2016, 7:31:00 AM1/28/16
to AngularJS

Hi,

I got the same problem, i'm not using ng-view, but ui-view (ui-router plugin). I have the same issue, when i try to use the following code to get the current app injector, it always return undefined.

angular.element(document.body).injector(); //return undefined.

Until i move the ui-view directive to a separate div, that not together with ng-app, then it work fine.
Reply all
Reply to author
Forward
0 new messages