Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid multiple interceptor instances due factory #365

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion build/loading-bar.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* angular-loading-bar v0.9.0
* https://chieffancypants.github.io/angular-loading-bar
* Copyright (c) 2016 Wes Cruver
* Copyright (c) 2017 Wes Cruver
* License: MIT
*/

Expand Down
7 changes: 4 additions & 3 deletions build/loading-bar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* angular-loading-bar v0.9.0
* https://chieffancypants.github.io/angular-loading-bar
* Copyright (c) 2016 Wes Cruver
* Copyright (c) 2017 Wes Cruver
* License: MIT
*/
/*
Expand Down Expand Up @@ -30,7 +30,7 @@ angular.module('chieffancypants.loadingBar', ['cfp.loadingBarInterceptor']);
* Registers itself as an Angular interceptor and listens for XHR requests.
*/
angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
.config(['$httpProvider', function ($httpProvider) {
.config(['$provide', '$httpProvider', function ($provide, $httpProvider) {

var interceptor = ['$q', '$cacheFactory', '$timeout', '$rootScope', '$log', 'cfpLoadingBar', function ($q, $cacheFactory, $timeout, $rootScope, $log, cfpLoadingBar) {

Expand Down Expand Up @@ -150,7 +150,8 @@ angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
};
}];

$httpProvider.interceptors.push(interceptor);
$provide.factory('LoadingBarInterceptor', interceptor);
$httpProvider.interceptors.push('LoadingBarInterceptor');
}]);


Expand Down
2 changes: 1 addition & 1 deletion build/loading-bar.min.css

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

4 changes: 2 additions & 2 deletions build/loading-bar.min.js

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

5 changes: 3 additions & 2 deletions src/loading-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ angular.module('chieffancypants.loadingBar', ['cfp.loadingBarInterceptor']);
* Registers itself as an Angular interceptor and listens for XHR requests.
*/
angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
.config(['$httpProvider', function ($httpProvider) {
.config(['$provide', '$httpProvider', function ($provide, $httpProvider) {

var interceptor = ['$q', '$cacheFactory', '$timeout', '$rootScope', '$log', 'cfpLoadingBar', function ($q, $cacheFactory, $timeout, $rootScope, $log, cfpLoadingBar) {

Expand Down Expand Up @@ -144,7 +144,8 @@ angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
};
}];

$httpProvider.interceptors.push(interceptor);
$provide.factory('LoadingBarInterceptor', interceptor);
$httpProvider.interceptors.push('LoadingBarInterceptor');
}]);


Expand Down