Search code examples
ember.jsember-cli

Customizing the implementation for auto generated controllers using EmberCLI


When using globals we could have defined App.Controller, App.ObjectController and App.ArrayController to control what class Ember will use to generate controllers.

With EmberCLI, I see documentation for routes - using app/routes/basic.js. This works fine.

Does it also work for views? What about controllers? How would I implement the 'basic' for each kind of controller?


Solution

  • Yes, this works for just about any object Ember would generate, including controllers. If you look here you can see that Ember looks for 3 different types of controllers to generate: basic, object, and array. You can override these defaults by creating the following files:

    app/controllers/basic.js
    app/controllers/object.js
    app/controllers/array.js