Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs ng仅在第一次迭代中重复显示自定义消息_Angularjs - Fatal编程技术网

Angularjs ng仅在第一次迭代中重复显示自定义消息

Angularjs ng仅在第一次迭代中重复显示自定义消息,angularjs,Angularjs,我有下面的代码下面的示例数据 $scope.studentPermissions = [ {entities[{StudentName: 'Tester', entityStudents[{FirstName: 'Test0', LastName: 'Test0', userPermissions[{prop 1, prop2, prop3}]}]}]}, {entities[{StudentName: 'Tester', entityStudents[{FirstName: 'Test1'

我有下面的代码下面的示例数据

$scope.studentPermissions  = [ 
{entities[{StudentName: 'Tester', entityStudents[{FirstName: 'Test0', LastName: 'Test0', userPermissions[{prop 1, prop2, prop3}]}]}]},
{entities[{StudentName: 'Tester', entityStudents[{FirstName: 'Test1', LastName: 'Test2', userPermissions[{prop 1, prop2, prop3}]}]}]},
{entities[{StudentName: 'Tester', entityStudents[{FirstName: 'Test3', LastName: 'Test4', userPermissions[{prop 1, prop2, prop3}]}]}]},
]
代码:

<div>
     <input type="text" ng-model="searchStudent">
    <div>
        <div ng-repeat="studentPermissions in studentPermissions">
            <div ng-repeat="student in studentPermissions.entities">
                <table>
                    <thead>
                        <tr>
                            <td >Student</td>
                            <td>{{student.StudentName}}</td>
                        </tr>
                        <tr>
                            <th></th>
                            <th ng-repeat="permission in student.entityStudents[0].userPermissions"><div><span>{{permission.Name}}</span></div></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="student in filteredData =(student.entityStudents | filter:searchStudent)">
                            <td>{{student.FirstName}} {{student.LastName}}</td>
                            <td ng-repeat="permission in student.userPermissions">
                                <input ng-model="permission.Checked" type="checkbox">
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div ng-show="!filteredData.length">No matching student found</div>
            </div>
        </div>
    </div>

学生
{{student.StudentName}
{{permission.Name}
{{student.FirstName}{{student.LastName}}
找不到匹配的学生
当前,如果未找到学员,则系统将显示
未找到数据
消息3次。事实上,每个
都会显示消息
未找到匹配的学生

我只想展示一个。。e、 g.如果消息已经在第一次迭代中显示,则不要在第二次迭代中显示


请帮忙。

把它移到ng的外面,好吗?并检查控制器中的数据,并将其绑定到元素。@Chrillewoodz如果我将filteredData从ng repeat移出,则无法识别它。。总是空的。超出范围。你能提供一把小提琴吗?我有点不清楚你到底想要什么。@Chrillewoodz,难道没有一种方法可以判断是否没有找到匹配的学生已经被执行了吗?即使看起来很简单也无所谓如果消息显示,您可以将控制器中的范围变量设置为true或false,然后基于此执行操作。