Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit ce54398

Browse files
committed
Merge branch 'lius-master' into dev (#18)
2 parents 466d094 + e6a701c commit ce54398

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

dist/angular-datatables.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
return new NGRenderer(options);
240240
}
241241
if (angular.isDefined(options)) {
242-
if (angular.isFunction(options.fnPromise)) {
242+
if (angular.isDefined(options.fnPromise)) {
243243
return new PromiseRenderer(options);
244244
}
245245
if (angular.isDefined(options.sAjaxSource)) {
@@ -314,7 +314,11 @@
314314
_loadedPromise = null;
315315
};
316316
var _startLoading = function (fnPromise) {
317-
_loadedPromise = fnPromise();
317+
if (angular.isFunction(fnPromise)) {
318+
_loadedPromise = fnPromise();
319+
} else {
320+
_loadedPromise = fnPromise;
321+
}
318322
_showLoading($elem);
319323
_loadedPromise.then(_whenLoaded);
320324
};
@@ -328,10 +332,10 @@
328332
}
329333
};
330334
$scope.$watch('dtOptions.fnPromise', function (fnPromise) {
331-
if (angular.isFunction(fnPromise)) {
335+
if (angular.isDefined(fnPromise)) {
332336
_reload(fnPromise);
333337
} else {
334-
throw new Error('You must provide a function that returns a promise!');
338+
throw new Error('You must provide a promise or a function that returns a promise!');
335339
}
336340
});
337341
$scope.$watch('dtOptions.reload', function (reload) {

0 commit comments

Comments
 (0)