diff --git a/src/ngScenario/Application.js b/src/ngScenario/Application.js index 1fdf3eb8a1bf..2ca6c8fdf555 100644 --- a/src/ngScenario/Application.js +++ b/src/ngScenario/Application.js @@ -92,9 +92,15 @@ angular.scenario.Application.prototype.executeAction = function(action) { } angularInit($window.document, function(element) { var $injector = $window.angular.element(element).injector(); + var $element = _jQuery(element); + + $element.injector = function() { + return $injector; + }; + $injector.invoke(function($browser){ $browser.notifyWhenNoOutstandingRequests(function() { - action.call(self, $window, _jQuery($window.document)); + action.call(self, $window, $element); }); }); }); diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js index 6f3a3c734f78..d5fc14382ce9 100644 --- a/src/ngScenario/dsl.js +++ b/src/ngScenario/dsl.js @@ -103,25 +103,25 @@ angular.scenario.dsl('browser', function() { api.url = function() { return this.addFutureAction('$location.url()', function($window, $document, done) { - done(null, $window.angular.element($window.document).injector().get('$location').url()); + done(null, $document.injector().get('$location').url()); }); }; api.path = function() { return this.addFutureAction('$location.path()', function($window, $document, done) { - done(null, $window.angular.element($window.document).injector().get('$location').path()); + done(null, $document.injector().get('$location').path()); }); }; api.search = function() { return this.addFutureAction('$location.search()', function($window, $document, done) { - done(null, $window.angular.element($window.document).injector().get('$location').search()); + done(null, $document.injector().get('$location').search()); }); }; api.hash = function() { return this.addFutureAction('$location.hash()', function($window, $document, done) { - done(null, $window.angular.element($window.document).injector().get('$location').hash()); + done(null, $document.injector().get('$location').hash()); }); };