/** * ngTable: Table + Angular JS * * @author Vitalii Savchuk * @url https://github.com/esvit/ng-table/ * @license New BSD License */ (function(){ 'use strict'; // todo: remove shim after an acceptable depreciation period angular.module('ngTable') .factory('ngTableGetDataBcShim', ngTableGetDataBcShim); ngTableGetDataBcShim.$inject = ['$q']; function ngTableGetDataBcShim($q){ return createWrapper; function createWrapper(getDataFn){ return function getDataShim(/*args*/){ var $defer = $q.defer(); var pData = getDataFn.apply(this, [$defer].concat(Array.prototype.slice.call(arguments))); if (!pData) { // If getData resolved the $defer, and didn't promise us data, // create a promise from the $defer. We need to return a promise. pData = $defer.promise; } return pData; } } } })();