I am trying to pass route params to my controller via the ‘setupController’ hook in my route handler.
First I’m referenced the (Specifying a Route's Model - Routing - Ember Guides) documentation on setting up an API call via **async model **in my route handler to incorporate the route params for my initial data fetch but need these variables passed onto the controller.
Currently adding the setupController
hook after async model
async model(params) {
const response = await fetch(`/my-cool-end-point.json${params.id}`);
const photos = await response.json();
return { photos };
}
Gives me a repeated error Cannot access 'params' before initialization
Any advice on how to improve my referencing here in order to find the desired documentation would be greatly appreciated.
Thanks