Reputation: 1449
I am struggling to perform filtering in my template by a radio button value.
My data looks like this:
{
"exerciseDescription": "Take a large step forward in standing and lower the rear knee towards the floor",
"exerciseName": "Walking Lunge",
"images": [223, 224, 225],
"difficulty" : 'Expert'
}
I would like to filter by difficulty
however have been unsuccessful in implementing the solutions from here and here
A codepen example is here any assistance on the best way to achieve this would be greatly appreciated.
Additionally I am using angular-masonry
if you can foresee any issues it would be great.
-- EDIT--
The correct answer implemented in a codepen is here
Upvotes: 0
Views: 757
Reputation: 1758
The problem is, the ionic direcitves create isolated scopes and the ng-model
of your radio inputs only adds the value to this scope, not to the scope of your controller. You can solve this by wrapping the filter property in an object, i.e. do something like:
$scope.filter = { 'difficulty' : 'Easy' }
...
<input type="radio" ng-model="filter.difficulty" value="Expert" name="group">
See: Angular Wiki - Understanding Scopes
Upvotes: 2