-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Services are not injected into scope after ng:include #155
Comments
can you create a test case at http://jsfiddle.net/ plz? |
actually that won't be possible (because of the xhr request). can you create an angular spec for this instead? thanks! |
I have written a scenario test for that and realized that:
So this issue is related only to doc. We should consider whether doc:example widget should manage to inject services. If so, I will write a scenario test for that: test including html template with doc:example (with defined service inside) and test whether the service is defined in the scope... |
we recently made a change to get away with the published services completely. in my opinion services should only rarely be used in view directly (that was one of the reasons why we removed the support for published services). going through the controller or having controller inject services needed in a view is much more preferred. I think we can close this issue as not relevant any more. if you think otherwise feel free to discuss it and we can reopen it again. |
Agree, removing published services is good step ! |
When you create custom service:
angular.service('custom', function() {}, {$creation: 'eager-published'});
Service should be injected in the scope, so you can call in the template:
test
It works in common page, but not inside included page.
You can test it in doc - @example as doc is loaded by ajax....
To get it work, you need to add controller, inject the service into the controller and call it through the controller.
The text was updated successfully, but these errors were encountered: