logOrderBy.js 667 B

1234567891011121314151617181920212223
  1. (function () {
  2. 'use strict';
  3. angular.module('ariaNg').filter('logOrderBy', ['$filter', 'ariaNgCommonService', function ($filter, ariaNgCommonService) {
  4. return function (array, type) {
  5. if (!angular.isArray(array) || !type) {
  6. return array;
  7. }
  8. var orderType = ariaNgCommonService.parseOrderType(type);
  9. if (orderType === null) {
  10. return array;
  11. }
  12. if (orderType.type === 'time') {
  13. return $filter('orderBy')(array, ['time'], orderType.reverse);
  14. } else {
  15. return array;
  16. }
  17. };
  18. }]);
  19. }());