C# AngularJS:在数组中搜索等效字符串

C# AngularJS:在数组中搜索等效字符串,c#,asp.net-mvc,angularjs,C#,Asp.net Mvc,Angularjs,我想制作一个搜索过滤器,在其中搜索项目的状态。我的数据库中的状态是int,因此我创建了每个索引的值和等价性 为了解释更多,这里是我的代码 MVC控制器 public JsonResult GetStatusList() { return Json(new string[] { "" ,"New" ,"Processing" ,"PR Approved"

我想制作一个搜索过滤器,在其中搜索项目的状态。我的数据库中的状态是int,因此我创建了每个索引的值和等价性

为了解释更多,这里是我的代码

MVC控制器

public JsonResult GetStatusList()
    { 
        return Json(new string[] {
            ""
            ,"New"
            ,"Processing"
            ,"PR Approved"
            ,"Qouting"
            ,"Qouting Approved"
            ,"PO Processing"
            ,"Closed"
            ,"Cancelled"
            ,"Rejected"
            ,"PO Issued"
            ,"On Delivery"
            ,"Received"
            ,"AP Posting"
            ,"Payment"
            ,"Sourcing"
            ,"Re-Processing"
        },JsonRequestBehavior.AllowGet);
    }
这是我的MVC视图

 <tr data-ng-repeat="model in models  | orderBy: sorting:reverse | filter : filter ">

                    <td>{{jsonDatetotext(model.RequestDate) | date:'MM/dd/yyyy'}}</td>
                    <td>
                        <a href="#" data-toggle="modal" data-target="#basicModalContent" data-ng-click="getSelectedPR(model)">{{model.RequestID}}
                        </a>
                    </td>
                    <td>{{model.PARNumber }}</td>
                    <td>{{model.ProgramName }}</td>
                    <td>{{model.FullName }}</td>
                    <td>{{model.DepartmentName | uppercase}}</td>
                    <td>{{model.PONo}}</td>
                    **<td>{{StatusList[model.StatusID] | uppercase}}</td>**
                    <td class="totalAmount"><span class="pull-right">{{model.TotalAmount | number:2}}</span>
                    </td>
                    <td>{{model.InboxLearUID | lowercase}}</td>
                </tr>

我希望状态本身将被搜索,而不仅仅是它的ID。

尝试将此添加到您的列表中。 我建议您在项目中使用复选框

    scope.array_ = angular.copy(scope.array);
        scope.getStatus = http.get('GetStatusList').success(function (status) {
            scope.StatusList = status;

        });


        PRApp.directive("checkboxGroup", function () {
            return {
                restrict: "A",
                link: function (scope, elem, attrs) {
                    // Determine initial checked boxes
                    if (scope.array.indexOf(scope.item.id) !== -1) {
                        elem[0].checked = true;
                    }

                    // Update array on click
                    elem.bind('click', function () {
                        var index = scope.array.indexOf(scope.item.id);
                        // Add if checked
                        if (elem[0].checked) {
                            if (index === -1) scope.array.push(scope.item.id);
                        }
                            // Remove if unchecked
                        else {
                            if (index !== -1) scope.array.splice(index, 1);
                        }
                        // Sort and update DOM display
                        scope.$apply(scope.array.sort(function (a, b) {
                            return a - b
                        }));
                    });
                }
            }
        });

我没看到过滤器?
    scope.array_ = angular.copy(scope.array);
        scope.getStatus = http.get('GetStatusList').success(function (status) {
            scope.StatusList = status;

        });


        PRApp.directive("checkboxGroup", function () {
            return {
                restrict: "A",
                link: function (scope, elem, attrs) {
                    // Determine initial checked boxes
                    if (scope.array.indexOf(scope.item.id) !== -1) {
                        elem[0].checked = true;
                    }

                    // Update array on click
                    elem.bind('click', function () {
                        var index = scope.array.indexOf(scope.item.id);
                        // Add if checked
                        if (elem[0].checked) {
                            if (index === -1) scope.array.push(scope.item.id);
                        }
                            // Remove if unchecked
                        else {
                            if (index !== -1) scope.array.splice(index, 1);
                        }
                        // Sort and update DOM display
                        scope.$apply(scope.array.sort(function (a, b) {
                            return a - b
                        }));
                    });
                }
            }
        });