mercredi 13 septembre 2017

passing actions and data from one controller to another controller in ember.JS

I am new to ember. i have got a situation where i have inventory module(which has its own controller, route, template, model). I have to display the whole inventory module as a popup in reservation desk module. I created a component which had the template code from inventory module and displayed that in reservation. I have got the UI. I injected the inventory controller in reservation controller. The main problem is that the action in component is handled by reservation module controller. But as the action is defined in inventory controller. So i am passing the action from reservation controller to inventory controller by this.get('inventoryController').send('goToPreviousMonth') where inventoryController is the injected inventory controller in reservation desk and goToPreviousMonth is the action that i am trying to send. Its is giving me an error because goToPreviousMonth function in inventory controller is accessing its model and other variables. these varaibles are set by other functions which are not getting called, because i am specifically calling only this function and not going with the code flow.

please suggest how to sort out the situation.

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire