makenai / robotnik

Drag and drop robotics educational library starring Johnny Five and Blockly (crowd goes wild)
52 stars 13 forks source link

cleaning up the route->model->component workflow #29

Closed BrianGenisio closed 9 years ago

BrianGenisio commented 9 years ago

This PR is preparing me to take the workshop and transform it to the blocks configuration.

Using the Angular router (like in many SPA frameworks), the router is actually responsible for fetching the data, not the controller. So I moved the behavior of model fetching to the route, and I pass it to the component as a "model" parameter, which the component can give a better name to.

I also took this opportunity to clean up the model code a bit. We don't need to include $q in the model functions because the angular-pouchdb module does it for us. We can just chain the promises.