Javascript 使用JQuery中找到的变量筛选Ng重复结果
我有使用AngularJs使用ng repeat显示的数据,不幸的是,我在AngularJs中没有找到一种可靠的方法来主动侦听window.location中的更改并做出响应,但我在Jquery中做到了这一点。我想从Jquery函数中获取结果,并使用参数过滤ng repeat结果。 下面是一个角度的示例:Javascript 使用JQuery中找到的变量筛选Ng重复结果,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我有使用AngularJs使用ng repeat显示的数据,不幸的是,我在AngularJs中没有找到一种可靠的方法来主动侦听window.location中的更改并做出响应,但我在Jquery中做到了这一点。我想从Jquery函数中获取结果,并使用参数过滤ng repeat结果。 下面是一个角度的示例: <div id="center" class="datagrid"> <table> <thead>
<div id="center" class="datagrid">
<table>
<thead>
<tr>
<th> ID </th>
<th> Phone </th>
<th> Address </th>
<th> Zip </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clients | orderBy:'id' | filter:{id:clientId} | limitTo: 1 track by $index">
<td>
{{client.id}}
</td>
<td>
<div class="form-group">
<input class="form-control" ng-model="updateform.phone" name="phone" ng-init="updateform.phone=client.phone" type="text "/>
</div>
</td>
<td>
<div class="form-group">
<input class="form-control" ng-model="updateform.address" name="address" ng-init="updateform.address = client.address" type="text "/>
</div>
</td>
<td>
<div class="form-group">
<input class="form-control" ng-model="updateform.zip" name="zip" ng-init="updateform.zip = client.zip" type="text "/>
</div>
</td>
</tr>
</tbody>
如果您使用的是
routeProvider
服务,您可以执行以下操作:
$rootScope.$on('$locationChangeSuccess', function(event){
var url = $location.url(),
})
您已经有一个名为$window的服务和一个名为$location:')的服务。我无法使用这些服务随url的更改动态更新数据,可能我误解了。无论您使用的是全局窗口还是
$window
,数据绑定都是一样的。如果您想在模板中使用它,请将其分配给$scope
我已经尝试过了,每次新的单击(动态)都不会得到相应的筛选结果
$rootScope.$on('$locationChangeSuccess', function(event){
var url = $location.url(),
})