aboutsummaryrefslogtreecommitdiffstats
path: root/src/Scope.js
diff options
context:
space:
mode:
authorIgor Minar2011-01-04 11:53:23 -0800
committerIgor Minar2011-01-04 18:04:00 -0800
commitb2631f61709ae71bb29ec6f1353f2a3c1ad33cd3 (patch)
tree4c955af5f726d29e2d6004d39403d0843f37711e /src/Scope.js
parent1430c6d6b1f4edf11b1bd877e8907ac8ab0be923 (diff)
downloadangular.js-b2631f61709ae71bb29ec6f1353f2a3c1ad33cd3.tar.bz2
rename scope.$inject to scope.$service
see changelog diff for more info
Diffstat (limited to 'src/Scope.js')
-rw-r--r--src/Scope.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Scope.js b/src/Scope.js
index 27df770d..393e015b 100644
--- a/src/Scope.js
+++ b/src/Scope.js
@@ -578,7 +578,7 @@ function createScope(parent, providers, instanceCache) {
foreach(Class.prototype, function(fn, name){
instance[name] = bind(instance, fn);
});
- instance.$inject.apply(instance, concat([Class, instance], arguments, 1));
+ instance.$service.apply(instance, concat([Class, instance], arguments, 1));
//TODO: backwards compatibility hack, remove when we don't depend on init methods
if (isFunction(Class.prototype.init)) {
@@ -615,7 +615,23 @@ function createScope(parent, providers, instanceCache) {
if (!parent.$root) {
instance.$root = instance;
instance.$parent = instance;
- (instance.$inject = createInjector(instance, providers, instanceCache))();
+
+ /**
+ * @workInProgress
+ * @ngdoc function
+ * @name angular.scope.$service
+ * @function
+ *
+ * @description
+ * Provides access to angular's dependency injector and
+ * {@link angular.service registered services}. In general the use of this api is discouraged,
+ * except for tests and components that currently don't support dependency injection (widgets,
+ * filters, etc).
+ *
+ * @param {string} serviceId String ID of the service to return.
+ * @returns {*} Value, object or function returned by the service factory function if any.
+ */
+ (instance.$service = createInjector(instance, providers, instanceCache))();
}
return instance;