Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4827

Layout property for declaring HTML in component?

$
0
0

@jdhines wrote:

I just read the EmberConf 2017 blog post, and found out about ember-redux for the first time (which I have other questions about how many people use this instead of Ember Data), but what really intrigued me is this syntax, as I like the idea of having the component's template and logic in one file:

export default Ember.Component.extend({
    number: Ember.computed(function() {
        return store.getState();
    }),
    actions: {
        add: function() {
            store.dispatch({type: 'ADD'});
        }
    },
    layout: hbs`  //<=== WHAT IS THIS????
      {{number}}
      <button onclick={{action "add"}}>add</button>
    `
});

I had no idea about this property, despite working on an Ember app for the past 2 years. My question is, is this meant to be a substitute for a template.hbs file? Or is it only for very simple components, or for something else?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles