我需要在 Angularjs 中使用 ng-click
在 URL 中传递参数 id
,我这样做是因为我想查看特定用户子文档数据一个单独的页面。
<tr ng-repeat="register in registerlist | filter:searchText">
<td>{{$index+1}}</td>
<td>{{register.name}}</td>
<td>{{register.email}}</td>
<td>{{register.mobile_no}}</td>
<td>{{register.area_name}}</td>
<td>
<button type="button" class="btn btn-default"
ng-click="RegisterView(register._id); showOrder = !showOrder">View</button>
</td>
</tr>
网址示例:localhost:8080//register/5426ced88b49d2e402402205
这里上面的用户有子文档,所以我需要在单独的页面中查看子文档。
Controller :
$scope.RegisterView = function(id) {
$scope.IsVisible = $scope.IsVisible ? false : true;
$http.get('/auth/register-list/' + id).success(function(response){
$scope.bookinglist = response.booking;
});
};
最佳答案
您可以在 $scope.RegisterView
函数中使用 $location
导航到其他页面。
像这样的 $location.path('/register/5426ced88b49d2e402402205')
关于javascript - 如何使用 ng-click 在 URL 中传递参数(id)以查看 Angularjs 中特定用户的子文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35356333/