IDIOMATIC EMBER – FINDING THE SWEET SPOT OF PERFORMANCE & PRODUCTIVITY
EMBERCONF 2016
Alpaca Route Template
{{#each alpacas as |alpaca|}}
I'm a cute little {{alpaca}}!
{{/each}}
{{foo-alpaca alpacas=alpacas}}
move to
• there are things you can do today to make this
transition easier
• the first key thing you can do is to move your route-level
template into a top-level component
• when routable components land, it basically just moves
that invocation into the route implicitly
IDIOMATIC EMBER – FINDING THE SWEET SPOT OF PERFORMANCE & PRODUCTIVITY
EMBERCONF 2016
// shopping-cart top-level component
export default Component.extend({
shoppingCart: inject.service(),
actions: {
remove(product) {
// ...
}
}
});
{{#each shoppingCart.products as |product|}}
{{product.title}}
{{product.description}}
Remove
{{/each}}
• the reason it's a good idea to use a top level
component now is that it forces you to separate your
stateful, singleton logic out and into a service
• a transition to a service for the stateful bits and a
component for the stateless bits is most likely to be
future proof
• and will make the transition an easier one