mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix(scenario): make browser().location() working if ng-app on other than <html>
This commit is contained in:
parent
499a76a08c
commit
5bcb749abb
2 changed files with 11 additions and 5 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue