0
내 $ routeParams를 기준으로 필터링하려고하지만 잘못된 작업을 수행하고 있어야합니다.Angular.js 필터가 올바르게 작동하지 않습니다.
내 컨트롤러 :
app.controller('servicesDetail', function ($scope, HC, $resource, $routeParams) {
HC.API.query(function (results) {
$scope.services = results;
});
$scope.json={};
json._id=$routeParams.id;
});
내 HTML/틀 :
<div class="services" ng-repeat="service in services | filter: json">
<article class="service group">
<a href="/services/{{service.name }}"><h3><pre>{{service.name }}</pre> </h3></a>
<p>{{service.name}}</p>
<a href="/services/{{service.name}}">more</a>
</article>
</div>
내 JSON : 나는 기본적으로 그냥 전체 목록에서 페이지를 필터링하기 위해 노력하고있어
{ "_id" : ObjectId("53bc3733b7bbbf77208dec65"), "name" : "this is from the client", "__v" : 0 }
{ "_id" : ObjectId("53bc37abb7bbbf77208dec66"), "name" : "new", "__v" : 0 }
세부 정보 페이지로 이동하고 $ routeParams를 사용하여 필터링하십시오.
고맙습니다! 초보자 실수. – byrdr