In my application I currently have a parent route that manages my query params. I have a component that resets these params using a closure action. The current implementation works and looks like this:
// Component
import Component from '@ember/component';
export default Component.extend({
tagName: '',
actions: {
actionTest() {
this.get('onClick')()
}
}
});
<div class="text-muted" style="cursor: pointer" ><small></small></div>
// Parent Route Controller
import Controller from '@ember/controller';
export default Controller.extend({
actions: {
resetAllParams() {
this.set('param1', null)
this.set('param2', null)
}
}
});
// Template
I would like to move the component from the Parent Route Template to a Sub Route template. When I do this I no longer have the ability to reset the params - my understanding that it isn't possible to manipulate the params of a parent route on a sub-route.
I think that I need an extra step in the closure action feature but I don't understand it very well. I tried to use Ember Route Action Helper but this doesn't appear appropriate for this use case.
I tried to 'bubble up' the action by adding the following:
// Sub-Route Template
// Sub Route Controller
import Controller from '@ember/controller';
export default Controller.extend({
resetAllParams(){}
});
But it error'd out with a 'this.get is not a function' error from the action in the component controller.
Any help greatly appreciated
Aucun commentaire:
Enregistrer un commentaire