From ece585af1d47dcc186b08615a90a157695d7c235 Mon Sep 17 00:00:00 2001 From: Ishai Strauss Date: Mon, 29 Jun 2020 11:40:01 -0500 Subject: [PATCH 1/2] allows for includeBar and includeSpinner callback (backwards compatible) --- build/loading-bar.js | 6 ++++-- src/loading-bar.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build/loading-bar.js b/build/loading-bar.js index 01630c0..14bc2fd 100644 --- a/build/loading-bar.js +++ b/build/loading-bar.js @@ -223,11 +223,13 @@ angular.module('cfp.loadingBar', []) $rootScope.$broadcast('cfpLoadingBar:started'); started = true; - if (includeBar) { + var _includeBar = !!(typeof includeBar === 'function' ? includeBar() : includeBar); + if (_includeBar) { $animate.enter(loadingBarContainer, $parent, $after); } - if (includeSpinner) { + var _includeBar = !!(typeof includeSpinner === 'function' ? includeBar() : includeSpinner); + if (_includeBar) { $animate.enter(spinner, $parent, loadingBarContainer); } diff --git a/src/loading-bar.js b/src/loading-bar.js index 44e092a..76a5338 100644 --- a/src/loading-bar.js +++ b/src/loading-bar.js @@ -217,10 +217,12 @@ angular.module('cfp.loadingBar', []) $rootScope.$broadcast('cfpLoadingBar:started'); started = true; - if (includeBar) { + var _includeBar = !!(typeof includeBar === 'function' ? includeBar() : includeBar); + if (_includeBar) { $animate.enter(loadingBarContainer, $parent, $after); } + var _includeBar = !!(typeof includeSpinner === 'function' ? includeBar() : includeSpinner); if (includeSpinner) { $animate.enter(spinner, $parent, loadingBarContainer); } From 2e0e4cb4bda6afbede0cb1daa68f962914d359f9 Mon Sep 17 00:00:00 2001 From: Ishai Strauss Date: Mon, 29 Jun 2020 11:54:28 -0500 Subject: [PATCH 2/2] fixes typo --- build/loading-bar.js | 4 ++-- src/loading-bar.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/loading-bar.js b/build/loading-bar.js index 14bc2fd..c3fb7a1 100644 --- a/build/loading-bar.js +++ b/build/loading-bar.js @@ -228,8 +228,8 @@ angular.module('cfp.loadingBar', []) $animate.enter(loadingBarContainer, $parent, $after); } - var _includeBar = !!(typeof includeSpinner === 'function' ? includeBar() : includeSpinner); - if (_includeBar) { + var _includeSpinner = !!(typeof includeSpinner === 'function' ? includeSpinner() : includeSpinner); + if (_includeSpinner) { $animate.enter(spinner, $parent, loadingBarContainer); } diff --git a/src/loading-bar.js b/src/loading-bar.js index 76a5338..c915e7e 100644 --- a/src/loading-bar.js +++ b/src/loading-bar.js @@ -222,8 +222,8 @@ angular.module('cfp.loadingBar', []) $animate.enter(loadingBarContainer, $parent, $after); } - var _includeBar = !!(typeof includeSpinner === 'function' ? includeBar() : includeSpinner); - if (includeSpinner) { + var _includeSpinner = !!(typeof includeSpinner === 'function' ? includeSpinner() : includeSpinner); + if (_includeSpinner) { $animate.enter(spinner, $parent, loadingBarContainer); }