M
M
mletov2017-01-10 17:26:30
Angular
mletov, 2017-01-10 17:26:30

By what principle and in what order should services be passed as parameters when creating a controller?

Such a problem:
Here I am creating a controller like this

app.controller('ModalInstanceCtrl',
               ['$scope', '$http', '$timeout', '$uibModalInstance', 'uiGridConstants',
               function ($scope, $http, $filter, $timeout, $uibModalInstance, $filter, uiGridConstants)

But when I call, either $timeout is undefined or $uibModalInstance, depending on the order in which they are passed to the controller.
I just can’t figure out the principle, which service depends on which, in what order to transfer them, so that they all work normally in the controller.
Explain, please, or throw a link to read with visual explanations.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2017-01-10
@mletov

The ordinal number of the argument matters.

app.controller('ModalInstanceCtrl',
               ['$1', '$2', '$3', '$4', '5',
               function ($1, $2, $3, $4, 5)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question