0

I am having two services: A: accountService B: invoiceService

Controllers: A: TicketController. B: InvoiceController.

below is the definition of TicketController:

angular.module("app").controller('TicketController', ['$scope', '$http', '$rootScope', 'uploadManager', 'ticketService', 'accountService', function ($scope, $http, $rootScope, uploadManager, ticketService, accountService) {

}]);

In Above controller accountService is working perfectly fine. but when I inject the same accountService to invoice controller it throws error. Below is the definition of invoiceController:

angular.module("app").controller('InvoiceController', ['accountService', 'invoiceService', function (accountService, invoiceService) {

}]);

when i execute it, it throws error: Error when I execute the above code for invoiceController

can anyone help what could be the problem?

Thanks in Advance.

3
  • I think there is an error in the accountService. Could you provide its code? Commented Mar 28, 2017 at 8:19
  • Have you added all the dependencies required for it? Commented Mar 28, 2017 at 8:27
  • show the index.html file Commented Mar 28, 2017 at 8:38

1 Answer 1

1

The code we can see looks perfectly fine.

Make sure that in your index.html that you load the files in the right order. If you try to load InvoiceController before you defined the accountService you will get this error.

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.