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

Component extending

$
0
0

@vasa-chi wrote:

Hi. Is there any way to make a component that extends another component?
Here's the code:

// my-base-component.js
export default Ember.Component.extend({
   classNames: "my-base-component"
});

// my-base-component.hbs
{{yield}}

// my-other-component.js
export default Ember.Component.extend({
   classNames: "my-other-component"
});

// my-other-component.hbs
{{#my-base-component}}
  whatever
{{/my-base-component}}

What I want to achieve, when rendering my-other-component:

<div class="my-base-component my-other-component">
    whatever
</div>

What I get:

<div class="my-other-component">
    <div class="my-base-component">
          whatever
    </div>
</div>

Now, I get that this is how ember works :slight_smile:
But is there any way to make ember work my way?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4831

Trending Articles