dimanche 25 septembre 2016

Ember js: Making dynamic routes and models and controllers

I have to replicate the same behaviour (nested routes, models, controller functions, store functionality) for like 12 different routes. The only difference is in their model attributes for which the template will also be updated. So for instance I have two routes named Notes and Tasks which are fetched in the same way and also have the same functionality in the controller but the Tasks route has attributes say Subject and Text whereas Notes has Name and Description but even the template functionality is the same.

What would be the best approach to not repeat the same functionality for such routes? Can one model or route or controller be created generic enough such that ember.js can decide on run time to do stuff for each individual route? Can I reuse one model/controller/route's functionality for the 12 different routes that I have?




Aucun commentaire:

Enregistrer un commentaire