UNPKG

zettapi_client

Version:

Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.

28 lines (24 loc) 727 B
app.directive('entityFilter', function () { return { restrict: 'E', scope: { entity: '@', table: '=', lookup: '=' }, transclude: true, templateUrl: 'directives/entity/entity.filter.html', controller: function ($scope, zapi) { var entityObj = zapi.entityMap[$scope.entity]; $scope.applySearch = function (search) { var criteria = angular.copy(search.text); var key = {}; if (entityObj && typeof entityObj.searchAttr === 'string') key = entityObj.searchAttr; else key = "$"; var filter = $scope.table.params._params.filter || {}; filter[key] = criteria; $scope.table.params.filter(filter); }; } }; });