From 890cebff5da4aed14d3c1b9e3e87c66b699a774d Mon Sep 17 00:00:00 2001 From: mohamed amr Date: Thu, 22 Oct 2015 18:42:27 +0200 Subject: [PATCH] define an AMD module if require.js is loaded --- src/loading-bar.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/loading-bar.js b/src/loading-bar.js index 364ca82..bc17c6f 100644 --- a/src/loading-bar.js +++ b/src/loading-bar.js @@ -320,4 +320,16 @@ angular.module('cfp.loadingBar', []) }]; // }); // wtf javascript. srsly + /** + * Support Require.JS AMD Modules + * Check if define is a function then + * define AMD module + */ + + if(typeof define === 'function') { + define([], function(){ + return angular.module('chieffancypants.loadingBar'); + }); + } + })(); //