A
A
Abc Edc2015-05-08 14:05:47
Angular
Abc Edc, 2015-05-08 14:05:47

What is DI used for?

What's the difference between

.controller('someCtrl', function($scope,mainService) {
mainService.method().....
})

and
.controller('someCtrl', function($scope) {
var myInjector = angular.injector(['app']);
 var service = myInjector.get('mainService');
service.method()...
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gavrilov, 2015-05-08
@gleber1

In what can be obtained through the injector service of another application
UPD: You can request the service through $injector from the line

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question