Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions dist/angularAMD.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ define(function () {
};

window.angular = alt_angular;

if (require.defined('angular')) {
require.undef('angular');
define('angular', [], alt_angular);
}
}

// Constructor
Expand Down Expand Up @@ -147,7 +152,10 @@ define(function () {
var resolve = config.resolve || {};
resolve['__AAMDCtrl'] = ['$q', '$rootScope', function ($q, $rootScope) { // jshint ignore:line
var defer = $q.defer();
require([load_controller], function (ctrl) {
if (typeof load_controller.push == "undefined") {
load_controller = [load_controller];
}
require(load_controller, function (ctrl) {
defer.resolve(ctrl);
$rootScope.$apply();
});
Expand Down Expand Up @@ -189,15 +197,16 @@ define(function () {
if (typeof alt_angular === 'undefined') {
throw new Error('Alternate angular not set. Make sure that `enable_ngload` option has been set when calling angularAMD.bootstrap');
}

// Process alternate queue in FIFO fashion
function processRunBlock(block) {
//console.info('"' + item.name + '": executing run block: ', run_block);
run_injector.invoke(block);
}

while (alternate_queue.length) {
var item = alternate_queue.shift(),
// Process the config blocks
for (var i=0;i<alternate_queue.length;i++) {
var item = alternate_queue[i],
invokeQueue = item.module._invokeQueue,
y;

Expand Down Expand Up @@ -245,18 +254,22 @@ define(function () {
}


// Execute the run block of the module
}

//after we have executed all config blocks, we finally execute the run blocks
while (alternate_queue.length) {
var item = alternate_queue.shift();
if (item.module._runBlocks) {
angular.forEach(item.module._runBlocks, processRunBlock);
}

/*
Clear the cached modules created by alt_angular so that subsequent call to
angular.module will return undefined.
*/
alternate_modules = {};
}

/*
Clear the cached modules created by alt_angular so that subsequent call to
angular.module will return undefined.
*/
alternate_modules = {};

};


Expand Down Expand Up @@ -317,6 +330,10 @@ define(function () {

// Restore original angular instance
window.angular = orig_angular;
if (require.defined('angular')) {
require.undef('angular');
define('angular', [], orig_angular);
}

// Clear stored app
orig_app = undefined;
Expand Down
2 changes: 1 addition & 1 deletion dist/angularAMD.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading