Javascript 如何在angularjs中过滤文本框中的数据

Javascript 如何在angularjs中过滤文本框中的数据,javascript,angularjs,Javascript,Angularjs,**您好,我正在从文本框中筛选数组数据,但是代码工作不正常。有人能帮我吗?后端的数据 self.AdminLineDetails=函数(数据){ $scope.details=[]; $scope.details=data.GoalData; 控制台日志(数据); } 您可以指定要在哪个属性上进行筛选,如 <tr ng-repeat="detail in details|filter: {firstName: query}"> 检查一下这个样品 您在实际代码中使用的是sel

**您好,我正在从文本框中筛选数组数据,但是代码工作不正常。有人能帮我吗?后端的数据


self.AdminLineDetails=函数(数据){
$scope.details=[];
$scope.details=data.GoalData;
控制台日志(数据);
}

您可以指定要在哪个属性上进行筛选,如

 <tr ng-repeat="detail in details|filter: {firstName: query}">

检查一下这个样品


您在实际代码中使用的是
self.AdminLineDetails=function(data)
那么我认为这是一个打字错误,用
$scope.AdminLineDetails…..
self.AdminLineDetails=function(data)替换为
self.AdminLineDetails=function(data)这是ajax调用成功函数“apiService.getAccountLineDetails(config).success(self.AdminLineDetails)(self.error);“嗨,我能知道他们的标准是什么吗??
<input type="text" ng-model="search">
<ul ng-repeat="oneauth in authorisations[0]">
    <li ng-repeat="entry in oneauth | nameFilter:search">{{entry.auth.name}}</li>
</ul>
var app = angular.module('myapp', [], function () {});

app.controller('AppController', function ($scope) {    
    $scope.authorisations = [{
        "authorisations":[
        {
            "auth":{
                "number":"453",
                "name":"Apple Inc."
            }
        },
        {
            "auth":{
                "number":"123",
                "name":"Microsoft Inc."
             }
        }]
    }];
});

app.filter('nameFilter', function(){
    return function(objects, criteria){
        var filterResult = new Array();
        if(!criteria)
            return objects;

        for(index in objects) {
            if(objects[index].auth.name.indexOf(criteria) != -1) // filter by name only
                filterResult.push(objects[index]);
        }
        console.log(filterResult);
        return filterResult;  
    }    
});