-
Notifications
You must be signed in to change notification settings - Fork 0
Containers and Widgets
In some areas of a screen we need to display multiple different views, dependent on the "state" of that area. A good example is the account area on the home screen, where we need to show a login, register and profile view - but not at the same time.
Those areas can be defined as containers for widgets. Containers use ember-layout and the {{dynamicView}} helper in the template to define attributes that can hold other views. In the simplest case (lice the account container on home screen) this is just one attribute that changes each time the next widget should be displayed. To declare a class/object as container you can use the Container mixin shown in the diagram:
Widgets are a simple wrapper around a view that provide methods to get the underlying view and to remove it from its current location. Widgets should be completely self-contained and might be configurable from the outside. They can speak to their delegate about important events and should register themselves in the global widget factory to be created.