I am trying to create an Angular filter on a radio button via ng-click that compares two seperate JSON objects and returns the object if the value is the same within a ng-repeat list.
Right now I am pulling in an event Api that returns an object that looks something like this -
Event API-
[{
"instructor_id": 502,
"datetime": "2014-12-07T00:30:00.000Z",
"end_time": "2014-12-07T01:00:00.000Z"
}, {
"instructor_url": 510,
"datetime": "2015-01-20T16:00:00.000Z",
"end_time": "2015-01-20T16:45:00.000Z"
}]
And I also have a separate Api that pulls in a list of the user's favorite instructor's and returns that favorited instructor's id, like this
Favorite Instructor API
[{
"user_id": 510
}, {
"user_id": 506
}]
I can get the filter to work if I just hard code in the instructor_id to a filter like so -
<input type="radio" ng-click="instructor_url = {instructor_url: '510}"/>
and then running the filter on my ng-repeat list
<li ng-repeat="event in events | filter:instructor_url">
But obviously this isn't what I'm looking for. I want to be able to call a function that matches them and returns only the events where the instuctor_id from the Event API match the user_is from the Favorite Instructor API.
Any help would be appreciated.