fix(loading): subsequent calls use config defaults and not last call's options. Fixes #2066, #2088

This commit is contained in:
Perry Govier
2014-09-26 15:26:01 -05:00
parent 7cad00837d
commit cffe631866
2 changed files with 15 additions and 1 deletions

View File

@@ -177,7 +177,7 @@ function($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop,
}
function showLoader(options) {
options = extend($ionicLoadingConfig || {}, options || {});
options = extend({}, $ionicLoadingConfig || {}, options || {});
var delay = options.delay || options.showDelay || 0;
//If loading.show() was called previously, cancel it and show with our new options

View File

@@ -216,5 +216,19 @@ describe('$ionicLoadingConfig', function() {
expect(loader.element.text()).toBe('some other template');
}));
it('should use the original defaults with subsequent calls', inject(function($ionicLoading, $timeout) {
var loader = TestUtil.unwrapPromise($ionicLoading._getLoader());
$ionicLoading.show({
template: 'some other template'
});
$timeout.flush();
expect(loader.element.text()).toBe('some other template');
$ionicLoading.hide();
$timeout.flush();
$ionicLoading.show();
$timeout.flush();
expect(loader.element.text()).toBe('some template');
}));
});