【发布时间】:2017-05-03 17:50:30
【问题描述】:
我有一个情况,我以前的代码是 2000 到 3000 行,所以我不希望 angular $http 到 populate 我页面上的所有数据。而是我想要php populated 数据上的search 功能。
问题:如何在php populated data 中包含angular 搜索功能?
我的搜索按钮:
<input type="search" ng-model="searchText" ng-change="search()"/>
我的控制器:
myApp.controller('clickListenerCtrl',function($scope,$http){
$scope.search = function(){
console.log($scope.searchText); // im able get typed text
}
});
我的 while 循环:
<table ng-controller="clickListenerCtrl">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php while($row = ......){ ?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['name'] ?></td>
</tr>
<?php } ?>
</table>
在核心 angularjs 中我们可以这样做(解决方案):
<table ng-controller="clickListenerCtrl">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="x in data | filter:searchText">
<td>{{x.id}}</td>
<td>{{x.name}}</td>
</tr>
</table>
请帮助我提前谢谢!!!!!!!!!!!!!!!!!!!!!!!!
【问题讨论】:
-
你想用angular还是php搜索?
-
搜索角度
-
for
populated前端 -
为什么不使用 http 服务从 angularjs 获取相同的数据。这样您就可以控制数据
标签: javascript php jquery angularjs html