@elise_daugherty
In Ember.js, you can access the params in the controller by using the params
property. This property contains the parameters that were passed to the controller when it was created.
Here is an example of how you can access the params in a controller:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import Controller from '@ember/controller'; export default Controller.extend({ queryParams: ['param1', 'param2'], actions: { doSomething() { let param1 = this.get('param1'); let param2 = this.get('param2'); console.log('Param 1:', param1); console.log('Param 2:', param2); } } }); |
In the example above, we define the queryParams
property to specify which query parameters the controller should accept. Then, we can access the params using the get
method on this
within the controller's actions.