【搜索按钮如何根据获取到的数据类型去搜索? 】 | IT修真院·坑乎
问题已收录 搜索按钮如何根据获取到的数据类型去搜索?
我也踩过这个坑( 1 )
已统计您的踩坑,无需重复点击
回答(1)
详细描述
截图
代码
编辑于2024-05-14
  • [北京|结业弟子]JS-肖明明
    0

    可以写一个search-params的自定义指令指令

    angular.module('admin')
    .directive('search', function () {
    return {
    templateUrl: 'js/directives/searchParams/search-params.html',
    replace: true,
    restrict: 'E',
    scope: {
    params: '='
    },
    controller: function ($scope, $state, commonUtil) {
    $scope.search = function () {
    $state.go($state.current, commonUtil.querySearchParams($scope.params), { reload: true })
    };
    $scope.clean = function () {
    angular.forEach($scope.params, function(data, index){
    if (index !== 'size') {
    $scope.params[index] = '';
    }
    })
    $state.go($state.current, commonUtil.querySearchParams($scope.params), { reload: true })
    }
    }
    }
    });


    编辑于2019-08-10