0

I am trying to get the angularjs service from Plain Javascript. I am using the below syntax.

angular.injector(['ng', 'error-handling']).get("messagingService").GetName();

When messagingservice does not contain any dependency this is working fine. When the messagingservice contains

.service('messagingService', ['$rootScope', 'applicationLogService', 'dialogService', MessageService])

then I am getting Unknown provider: dialogServiceProvider <- dialogService <- messagingService error. I have included the js file for dialogservice already. Can any one help where I am missing ? Is there any other syntax need to be followed in getting service with dependency?

4
  • post the dialogService js Commented Feb 10, 2016 at 15:40
  • It is a big file. I am using the same file in other angular parts and it is working fine. This page is not angular and so I am trying explicitly to inject. Is that any other steps need to done before calling messageservice. Commented Feb 10, 2016 at 15:53
  • Why can't you give angular control on this page ? (with ngp-app and small controller) Commented Feb 10, 2016 at 16:28
  • @Okazari Yes that is the work around solution I am thinking if this is not going to work. But want to know why this is not working. Commented Feb 10, 2016 at 16:30

1 Answer 1

3

It should be

angular.injector(['ng', 'error-handling', 'module-that-owns-dialogService' ])
  .get("messagingService").GetName();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.