I’ve been finding issues in an Ember application I’m working on where the author (me) didn’t fully grasp Ember controllers. Here are a few controller concepts I’ve learned.
Controller Concepts
* A controller is a decorator for your models. It proxies all the get and set calls to the underlying model unless that property is defined on the controller itself.
* Controllers are fleeting, but models are forever (if you’re taking an Ember Data-like approach). As you route around your application, controllers will be destroyed so don’t count on them surviving very long. An exception to this is the immortal application controller.
* You don’t necessarily need a controller, especially if you’re not holding onto application state. The router events object is a great place to save, create, and delete models.
Your new post is loading...