Brijesh shah Brijesh shah - 1 year ago 75
AngularJS Question

how to inject a service on basis of condition in angular js?

There is two services in my angular app first service is for testing Demo API and second is for Live API. I want to inject those service on condition basis, how can I inject those service on condition basis.

Thanks in Advance..

Answer Source

You can find $Injector doc here:$injector

.controller('myCtrl', function($injector){
 var myService;
     myService = $injector.get('myService');

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download