In my application design I use a multilayered approach (see this for additional info). To pass data between layers I user Business Objects/Entities. Basically they are “expensive” property bags (if you understand the expression “cheap property bags”), but serve to carry data from the database or data layer into the UI and back again. In the second article, if you change tiers to layers, that is how my applications are structured.
The BLL (business logic layer) acts as Ember’s router to decide how data can be created, modified and destroyed. I want to create an object on one page and pass it to the appropriate route when done. I’m hoping to use a query string parameter so the page that creates the object knows which route to pass the object to when done.
The route would load the data for that controller/view (the model) and add this newly created object to the model (also save) and display the page/view as normal. But I see no way to pass a created object from one controller to another route.
OK, as I was typing this I had this pop into my head. ControllerA could call it’s route (RouteA) to access the route’s method controllerFor to get ControllerB and pass the new object to ControllerB (causing B to save the data) and then ControllerA could transition to RouteB which would load the new data and display ViewB (what I want to happen). The only problem is I don’t see a property on the controller that gives me access to it’s route (this.route?).
How do you solve/handle this kind of problem?