mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-01 12:33:37 +08:00
refactor(scenario): fix scenario bootstrap & publish injector for inspection
This commit is contained in:
@@ -81,8 +81,9 @@ angular.scenario.dsl('clearCookies', function() {
|
||||
*/
|
||||
return function() {
|
||||
this.addFutureAction('clear all cookies', function($window, $document, done) {
|
||||
var rootScope = $window.angular.element($document[0]).data('$scope'),
|
||||
$cookies = rootScope.$service('$cookies'),
|
||||
var element = $window.angular.element($document[0]),
|
||||
rootScope = element.scope(),
|
||||
$cookies = element.data('$injector')('$cookies'),
|
||||
cookieName;
|
||||
|
||||
rootScope.$apply(function() {
|
||||
|
||||
@@ -956,7 +956,9 @@ function angularInit(config, document){
|
||||
});
|
||||
createInjector(modules, angularModule)(['$rootScope', '$compile', '$injector', function(scope, compile, injector){
|
||||
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) {
|
||||
return action.call(this, $window, _jQuery($window.document));
|
||||
}
|
||||
var $browser = $window.angular.service.$browser();
|
||||
$browser.notifyWhenNoOutstandingRequests(function() {
|
||||
action.call(self, $window, _jQuery($window.document));
|
||||
var element = $window.angular.element($window.document.body);
|
||||
var $injector = element.inheritedData('$injector');
|
||||
$injector(function($browser){
|
||||
$browser.notifyWhenNoOutstandingRequests(function() {
|
||||
action.call(self, $window, _jQuery($window.document));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user