Handling UI behavior using components
Components are the building blocks of dynamic UI fragments or elements in Ember. They render a template, optionally backed by a class extending Ember.Component
.
The easiest way to create a component is to create a template file with a dash-separated name in the app/components/
directory. Then you can embed it in inside other templates by just calling {{<component-name>}}
and passing the required parameters.
Components are independent and completely isolated from the client context; all required data must be passed as parameters. However, if you use {{yield}}
inside the template, it essentially becomes a block (or container) component, where you can add any content; this content can access any controller attribute ...
Get Spring MVC: Designing Real-World Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.