From 311b32b1d274976bd54e4cce04fd514ebc3222ee Mon Sep 17 00:00:00 2001 From: JannieP Date: Fri, 15 Apr 2016 20:42:35 +0200 Subject: [PATCH] Added fallback for continueOnError Allow the Application to still get launched in order to handle the error gracefully. Pass error into the module via same defined constant --- src/deferred-bootstrap.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/deferred-bootstrap.js b/src/deferred-bootstrap.js index 27f9741..8f4cb2a 100644 --- a/src/deferred-bootstrap.js +++ b/src/deferred-bootstrap.js @@ -137,12 +137,14 @@ function bootstrap (configParam) { } } - function handleResults (results) { + function handleResults (results,error) { forEach(results, function (value, index) { var result = value && value.data ? value.data : value, moduleName = constants[index].moduleName, constantName = constants[index].name; - + if (error){ + result._error=error; + } angular.module(moduleName).constant(constantName, result); }); @@ -154,6 +156,10 @@ function bootstrap (configParam) { if (isFunction(config.onError)) { config.onError(error); } + if (config.continueOnError){ + handleResults (constants,error); + return doBootstrap(element, module, bootstrapConfig); + } } if (config.moduleResolves) {