From 48697a2b86dbb12ea8de64cc5fece7caf68b321e Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 17 Oct 2011 16:56:56 -0700 Subject: refactor(injector): turn scope into a service - turn scope into a $rootScope service. - injector is now a starting point for creating angular application. - added inject() method which wraps jasmine its/beforeEach/afterEach, and which allows configuration and injection of services. - refactor tests to use inject() where possible BREAK: - removed angular.scope() method --- src/service/defer.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/service/defer.js') diff --git a/src/service/defer.js b/src/service/defer.js index 42f80d25..07c98065 100644 --- a/src/service/defer.js +++ b/src/service/defer.js @@ -28,12 +28,10 @@ * @param {*} deferId Token returned by the `$defer` function. * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfuly canceled. */ -angularServiceInject('$defer', function($browser) { - var scope = this; - +angularServiceInject('$defer', function($rootScope, $browser) { function defer(fn, delay) { return $browser.defer(function() { - scope.$apply(fn); + $rootScope.$apply(fn); }, delay); } @@ -42,4 +40,4 @@ angularServiceInject('$defer', function($browser) { }; return defer; -}, ['$browser']); +}, ['$rootScope', '$browser']); -- cgit v1.2.3