I'm entirely sure I'm going about this the wrong way but seeing how new I am with angularjs I can't figure out how to accomplish what I want. I have a set of users that I am loping through using ng-repeat
, but I can't figure out how to filter by the scope variable userId
. The User id: <name>
is being printed out just fine, so there is no issues with the scope. How can I have the ng-repeat
loop sort by this userId
? If I'm going about it the wrong what, can you please link me documentation that will help me go about it the right way.
HTML:
User id: {{userId}}
<br>
User Name:
<ul>
<li ng-repeat="user in users | filter:{{userId}}">
{{user.name}}
</li>
</ul>
Controller:
function PhoneDetailController($scope, $routeParams, Users){
$scope.userId = $routeParams.userId;
}