mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-02 22:37:07 +08:00
fix(scenario): make browser().location() working if ng-app on other than <html>
This commit is contained in:
@@ -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());
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user