js:
$scope.arr = [
["212","上","下","左","右"],
["12","1","2","3","4"],
]
html:
<input type="text" ng-model="text">
<tr ng-repeat="dataTr in arr | filter:text">
<td ng-repeat="dataTd in dataTr">
<ng-switch on="$first">
<span ng-switch-when="true">{{index+1}}</span>
<span ng-switch-default>{{dataTd}}</span>
</ng-switch>
</td>
</tr>
二维数组里面的第一列不显示,所以在搜索的时候需要排除arri,如果我输入1,两列都有的,但是我想输入1只显示arr[0],怎么做啊?我将filter写成函数,但是没搞定
Use arr.slice(1, arr.length)
Okay, I read the question wrong, just add a map
Since angular expression does not support function declaration, you need to write this paragraph in the controller and reassign it to
$scope.arr