I’m trying to create two different filters on the IndexRoute (one for active projects, another for archived projects). I’m able to pull the active projects using the following code:
So you can do it multiple ways.
One is to have a argument in your route, such as …/index?projectStatus=active or …/index?projectStatus=archived.
Your Route could do something like:
This way your api can only send relevant data instead of filtering the data locally.
In my opinion, this option is the most elegant unless you’re dealing with very small datasets and you want to avoid multiple http trips.
Another option is to retrieve all the data or data based on same other filter and use a computed property locally.