raw/angular-datatables/angular-datatables.js
function (options) {
        var oTable;
        var _render = function (options, $elem, data, $scope) {
          options.aaData = data;
          // Add $timeout to be sure that angular has finished rendering before calling datatables
          $timeout(function () {
            _hideLoading($elem);
            // Set it to true in order to be able to redraw the dataTable
            options.bDestroy = true;
            // Condition to refresh the dataTable
            if (oTable) {
              if (_isDTOldVersion(oTable)) {
                oTable.fnClearTable();
                oTable.fnDraw();
                oTable.fnAddData(options.aaData);
              } else {
                oTable.clear();
                oTable.rows.add(options.aaData).draw();
              }
            } else {
              oTable = _renderDataTableAndEmitEvent($elem, options, $scope);
            }
          }, 0, false);
        };
        return {
          options: options,
          render: function ($scope, $elem) {
            var _this = this, _loadedPromise = null, _whenLoaded = function (data) {
                _render(_this.options, $elem, data, $scope);
                _loadedPromise = null;
              }, _startLoading = function (fnPromise) {
                if (angular.isFunction(fnPromise)) {
                  _loadedPromise = fnPromise();
                } else {
                  _loadedPromise = fnPromise;
                }
                _showLoading($elem);
                _loadedPromise.then(_whenLoaded);
              }, _reload = function (fnPromise) {
                if (_loadedPromise) {
                  _loadedPromise.then(function () {
                    _startLoading(fnPromise);
                  });
                } else {
                  _startLoading(fnPromise);
                }
              };
            $scope.$watch('dtOptions.fnPromise', function (fnPromise) {
              if (angular.isDefined(fnPromise)) {
                _reload(fnPromise);
              } else {
                throw new Error('You must provide a promise or a function that returns a promise!');
              }
            });
            $scope.$watch('dtOptions.reload', function (reload) {
              if (reload) {
                $scope.dtOptions.reload = false;
                _reload($scope.dtOptions.fnPromise);
              }
            });
          }
        };
      }
function (options) {
        var oTable;
        var _render = function (options, $elem, data, $scope) {
          options.aaData = data;
          // Add $timeout to be sure that angular has finished rendering before calling datatables
          $timeout(function () {
            _hideLoading($elem);
            // Set it to true in order to be able to redraw the dataTable
            options.bDestroy = true;
            // Condition to refresh the dataTable
            if (oTable) {
              if (_isDTOldVersion(oTable)) {
                oTable.fnClearTable();
                oTable.fnDraw();
                oTable.fnAddData(options.aaData);
              } else {
                oTable.clear();
                oTable.rows.add(options.aaData).draw();
              }
            } else {
              oTable = _renderDataTableAndEmitEvent($elem, options, $scope);
            }
          }, 0, false);
        };
        return {
          options: options,
          render: function ($scope, $elem) {
            var _this = this, _loadedPromise = null, _whenLoaded = function (data) {
                _render(_this.options, $elem, data, $scope);
                _loadedPromise = null;
              }, _startLoading = function (fnPromise) {
                if (angular.isFunction(fnPromise)) {
                  _loadedPromise = fnPromise();
                } else {
                  _loadedPromise = fnPromise;
                }
                _showLoading($elem);
                _loadedPromise.then(_whenLoaded);
              }, _reload = function (fnPromise) {
                if (_loadedPromise) {
                  _loadedPromise.then(function () {
                    _startLoading(fnPromise);
                  });
                } else {
                  _startLoading(fnPromise);
                }
              };
            $scope.$watch('dtOptions.fnPromise', function (fnPromise) {
              if (angular.isDefined(fnPromise)) {
                _reload(fnPromise);
              } else {
                throw new Error('You must provide a promise or a function that returns a promise!');
              }
            });
            $scope.$watch('dtOptions.reload', function (reload) {
              if (reload) {
                $scope.dtOptions.reload = false;
                _reload($scope.dtOptions.fnPromise);
              }
            });
          }
        };
      }
function ( options ) { var oTable ; var _render = function ( options , $elem , data , $scope ) { options . aaData = data ; // Add $timeout to be sure that angular has finished rendering before calling datatables $timeout ( function ( ) { _hideLoading ( $elem ) ; // Set it to true in order to be able to redraw the dataTable options . bDestroy = true ; // Condition to refresh the dataTable if ( oTable ) { if ( _isDTOldVersion ( oTable ) ) { oTable . fnClearTable ( ) ; oTable . fnDraw ( ) ; oTable . fnAddData ( options . aaData ) ; } else { oTable . clear ( ) ; oTable . rows . add ( options . aaData ) . draw ( ) ; } } else { oTable = _renderDataTableAndEmitEvent ( $elem , options , $scope ) ; } } , 0 , false ) ; } ; return { options : options , render : function ( $scope , $elem ) { var _this = this , _loadedPromise = null , _whenLoaded = function ( data ) { _render ( _this . options , $elem , data , $scope ) ; _loadedPromise = null ; } , _startLoading = function ( fnPromise ) { if ( angular . isFunction ( fnPromise ) ) { _loadedPromise = fnPromise ( ) ; } else { _loadedPromise = fnPromise ; } _showLoading ( $elem ) ; _loadedPromise . then ( _whenLoaded ) ; } , _reload = function ( fnPromise ) { if ( _loadedPromise ) { _loadedPromise . then ( function ( ) { _startLoading ( fnPromise ) ; } ) ; } else { _startLoading ( fnPromise ) ; } } ; $scope . $watch ( 'dtOptions.fnPromise' , function ( fnPromise ) { if ( angular . isDefined ( fnPromise ) ) { _reload ( fnPromise ) ; } else { throw new Error ( 'You must provide a promise or a function that returns a promise!' ) ; } } ) ; $scope . $watch ( 'dtOptions.reload' , function ( reload ) { if ( reload ) { $scope . dtOptions . reload = false ; _reload ( $scope . dtOptions . fnPromise ) ; } } ) ; } } ; }
Renderer for displaying with a promise
@param options the options
@returns {{options: *}} the renderer
@constructor
Renderer for displaying with a promise