Fixes js errors with apply since a digest is already in operation.
This commit is contained in:
@@ -69,6 +69,23 @@ angular.module("umbraco.install").factory('installerService', function($rootScop
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Have put this here because we are not referencing our other modules */
|
||||||
|
function safeApply (scope, fn) {
|
||||||
|
if (scope.$$phase || scope.$root.$$phase) {
|
||||||
|
if (angular.isFunction(fn)) {
|
||||||
|
fn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (angular.isFunction(fn)) {
|
||||||
|
scope.$apply(fn);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scope.$apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
|
|
||||||
status : _status,
|
status : _status,
|
||||||
@@ -240,9 +257,9 @@ angular.module("umbraco.install").factory('installerService', function($rootScop
|
|||||||
processInstallStep();
|
processInstallStep();
|
||||||
},
|
},
|
||||||
|
|
||||||
randomFact : function(){
|
randomFact: function () {
|
||||||
$rootScope.$apply(function(){
|
safeApply($rootScope, function() {
|
||||||
service.status.fact = facts[ _.random( facts.length-1) ];
|
service.status.fact = facts[_.random(facts.length - 1)];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user