store.findRecord('school', school_id, {
include: [
'students',
'students.records'
].join(',')
Using the above code fetching school, students, students' records data in inital load. In the initial load, I don't need students.records (only listing students initially)
Need student records only when clicking some button (All Students Performance - to display a performance chart) Is there any way to fetch associated records separately and link with the existing model
I have sperate api endpoint for fetch students' records
emphasized textyou could use a nested route? maybe something like:
This is all using the same
schoolsendpoint. If you want to fetch only the student's records, without hitting the school's endpoint, that depends on your API's capabilities.if you wanted to fetch a singular student's records you'd probably want to have a sub-route for the student, and do something like this:
and you'd link to that route like this:
and in your student route, you'd want to construct your model hook like this:
You may want to open another question about your API if you're uncertain how to interact with it. There we could explore how it is structured, like if it's a http://jsonapi.org/ API or a non-standard rest api.
hope this helps.