Ng-repeat | filter: non working properly, filtering a JSON by $id with :true


Hello people.
I’ve created a List of Stores, which I receive in a JSON file, and print it with ng-repeat in a List.html view. Works perfect.
Then I click on one and it takes me to a Detail.html view, where I can see the Business with more information.

I have in Detail the ‘same’ ng-repeat ALL stores from the JSON but I filter them with the following code:

<ion-item class="item" ng-repeat="item in spots | filter:{id: idSpot}">

This gives me the problem, that when I send a number 3, it prints all the 3’s within the JSON (3, 33, 30, 53,…)

Then! I found I could add the true clause, that allows me to make an strict filtering like follows:

<ion-item class="item" ng-repeat="item in spots | filter:{id: idSpot}:true">

But this true works only if i use an INT ( filter:{id: 7}:true ) but does not work when i use the $scope.idSpot variable.

Why is it failing? I feel so close… but does not work.

Thanks a lot!


There’s a basic AngularJS instance working: