Sha256: 6d3cf053ccd95d21a7cbc4b7a79e41c96ac8c1706ae120a19f3f915009b55d79
Contents?: true
Size: 1.28 KB
Versions: 8
Compression:
Stored size: 1.28 KB
Contents
(function (undefined) { angular.module('rails').factory('RailsResourceInjector', ['$injector', function($injector) { /** * Allow dependencies to be referenced by name or instance. If referenced by name AngularJS $injector * is used to retrieve the dependency. * * @param dependency (string | function) The dependency to retrieve * @returns {*} The dependency */ function getDependency(dependency) { if (dependency) { return angular.isString(dependency) ? $injector.get(dependency) : dependency } return undefined; } /** * Looks up and instantiates an instance of the requested service. If the service is not a string then it is * assumed to be a constuctor function. * * @param service (string | function) The service to instantiate * @returns {*} A new instance of the requested service */ function createService(service) { if (service) { return $injector.instantiate(getDependency(service)); } return undefined; } return { createService: createService, getDependency: getDependency } }]); }());
Version data entries
8 entries across 8 versions & 1 rubygems