mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-25 22:33:44 +00:00
refactor(scenario): fix scenario bootstrap & publish injector for inspection
This commit is contained in:
parent
7cb03c5ab9
commit
4b35a59c6a
3 changed files with 12 additions and 6 deletions
|
|
@ -81,8 +81,9 @@ angular.scenario.dsl('clearCookies', function() {
|
||||||
*/
|
*/
|
||||||
return function() {
|
return function() {
|
||||||
this.addFutureAction('clear all cookies', function($window, $document, done) {
|
this.addFutureAction('clear all cookies', function($window, $document, done) {
|
||||||
var rootScope = $window.angular.element($document[0]).data('$scope'),
|
var element = $window.angular.element($document[0]),
|
||||||
$cookies = rootScope.$service('$cookies'),
|
rootScope = element.scope(),
|
||||||
|
$cookies = element.data('$injector')('$cookies'),
|
||||||
cookieName;
|
cookieName;
|
||||||
|
|
||||||
rootScope.$apply(function() {
|
rootScope.$apply(function() {
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,9 @@ function angularInit(config, document){
|
||||||
});
|
});
|
||||||
createInjector(modules, angularModule)(['$rootScope', '$compile', '$injector', function(scope, compile, injector){
|
createInjector(modules, angularModule)(['$rootScope', '$compile', '$injector', function(scope, compile, injector){
|
||||||
scope.$apply(function(){
|
scope.$apply(function(){
|
||||||
compile(isString(autobind) ? document.getElementById(autobind) : document)(scope);
|
var element = jqLite(isString(autobind) ? document.getElementById(autobind) : document);
|
||||||
|
element.data('$injector', injector);
|
||||||
|
compile(element)(scope);
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,11 @@ angular.scenario.Application.prototype.executeAction = function(action) {
|
||||||
if (!$window.angular) {
|
if (!$window.angular) {
|
||||||
return action.call(this, $window, _jQuery($window.document));
|
return action.call(this, $window, _jQuery($window.document));
|
||||||
}
|
}
|
||||||
var $browser = $window.angular.service.$browser();
|
var element = $window.angular.element($window.document.body);
|
||||||
$browser.notifyWhenNoOutstandingRequests(function() {
|
var $injector = element.inheritedData('$injector');
|
||||||
action.call(self, $window, _jQuery($window.document));
|
$injector(function($browser){
|
||||||
|
$browser.notifyWhenNoOutstandingRequests(function() {
|
||||||
|
action.call(self, $window, _jQuery($window.document));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue