Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to render a component instance? #11573

Closed
QuantumKing opened this issue Jun 28, 2015 · 7 comments
Closed

Is there a way to render a component instance? #11573

QuantumKing opened this issue Jun 28, 2015 · 7 comments

Comments

@QuantumKing
Copy link

Is it possible to achieve something like this?

// app/controllers/index.js
Ember.Controller.extend({
  myComponent: Ember.Component.extend({})
});
{{! app/templates/index.hbs }}
{{component myComponent}}

I can't find it in the documentation. It used to be possible using views.

@stefanpenner
Copy link
Member

#10093

@QuantumKing
Copy link
Author

Ok, so it's not possible from what I'm reading. What's the correct way of achieving something like this?

@csantero
Copy link
Contributor

@QuantumKing emberjs/rfcs#64 might be what you're looking for.

@rwjblue
Copy link
Member

rwjblue commented Jun 28, 2015

Component helper requires components to be looked up in the container (and does not allow locally defined components to be accessed).

You should take a look at emberjs/rfcs#64, which proposes a solution similar to your example code.

@rwjblue
Copy link
Member

rwjblue commented Jul 1, 2015

Closing this in favor of the RFC...

@rwjblue rwjblue closed this as completed Jul 1, 2015
@chadian
Copy link

chadian commented Jan 14, 2016

Hi,

Was just curious if this ever made it in? I've been trying to setup something twiddle with ember canary that would let me do something described by this issue. I've followed these references in trying to get this to work:

Both {{component refToComp}} and {{refToComp}} from something like:

import someComponent from 'someComponent';
export default Ember.Component.create({
  refToComp: someComponent.create({ changingDefaultProp: 'changed value' }) 
})

hasn't worked out for me.

Any guidance is greatly appreciated, thanks!

@rwjblue
Copy link
Member

rwjblue commented Jan 14, 2016

@chadian - Looks like you are mostly describing the new (in 2.3) contextual components feature. You might want to check out the 2.3.0-beta blog post for details...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants