@domenico
To create a generic controller model in Ember.js, you can follow the steps below:
1 2 3 4 5 6 7 |
// app/controllers/base-controller.js import Controller from '@ember/controller'; export default Controller.extend({ // Your generic controller logic goes here }); |
1 2 3 4 5 6 7 |
// app/controllers/posts.js import BaseController from './base-controller'; export default BaseController.extend({ // Specific controller logic for handling posts }); |
1 2 3 4 5 6 7 8 9 |
// app/routes/posts.js import Route from '@ember/routing/route'; export default Route.extend({ model() { return this.store.findAll('post'); } }); |
By following these steps, you can create a generic controller model in Ember.js that can be easily extended and reused throughout your application.