-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
consider a component helper for dynamic component loading. #5007
Comments
I've been using component-lookup:main along with the {{view}} helper. The downside to this is that the view is not torn down when the dynamic property is changed. I have a local branch where I am work on on making the view helper handle this properly. |
Seems like view being bound and tore down would be great. But a component helpers dedicated to component lookups would also be good |
@rjackson the |
I kinda feel like this isn't addon material as it enables better core composition |
I would be pretty happy if someone had time to implement this. I will gladly provided feedback and advocate for it |
This seems related to stuff I've wanted for the Perhaps there's a better overall primitive to consider, something like a Render Descriptor, which is best described by example:
And this of course would extend to free to dynamic component renderings, but should be possible to render anything from a helper to a component to a view to a link. |
We used something like this for dynamic input elements. Had to have an observer call |
@igorT tell me more, curious |
I want something like this for Ember (one exists for angular), and the one thing that's missing is easily swappable render parameters for overriding certain fields. |
Don't have access to the code anymore, but it was basically a wrapper component that had a |
could you elaborate on "the one thing that's missing is easily swappable render parameters for overriding certain fields" @machty ?? We have a few dynamic components in our codebase using slightly different techniques, could explain better if I knew your use case. |
@jcollins1991 I'm saying if you have |
Would love to have something like this, I've hacked around it with a |
i think this is a good idea, but not really an issue. If someone wants to follow up with a PR that would be great |
I'd like to suggest re-opening this issue. See here for some background: http://discuss.emberjs.com/t/programmatically-rendering-ember-components/6986/2. Basically, we have been able to, in the past, create a helper that renders a component based on a bound property, however the internals of this 'render-component' helper have changed with individual releases of Ember, and as of 1.9 (possibly 1.8), it no longer functions (again, see the link above for background). |
I very quickly wrote what I believe is a simple solution to this problem. I am not intimately familiar with the inner workings of Ember though, so I could be way off base here. What I did is add a new helper in
I did a quick test in my application and it seemed to work correctly. Thoughts? |
@green-arrow - That would work for a single one time lookup of a component from a bound property, but would not tear down and set up a new component if the bound property changed (this is roughly the same limitation as the {{view}} helper). |
@rwjblue - ah, I figured it couldn't be that the easy. Is this acceptable? Or would somebody else be interested in making this happen / pointing me in the right direction on making it happen? |
@green-arrow @rwjblue I am fine with an dynamic, unbound |
@mmunoz Would taking a similar approach to the partial helper be On Sunday, December 28, 2014, Martin Muñoz [email protected] wrote:
|
@lukemelia Yes, definitely. |
@mmunoz cool. I have some work in progress and should be able to pull On Sunday, December 28, 2014, Martin Muñoz [email protected] wrote:
|
@lukemelia I think we want to assert that the first argument is always a string name to be looked up in the container, so we don't make the same mistakes as the |
@mmunoz makes sense. I was planning to start by making the view helper get On Sunday, December 28, 2014, Martin Muñoz [email protected] wrote:
|
@lukemelia - ❤️ @mmun has made this much better/easier with his recent refactorings of the view helper. |
@lukemelia - Let me know if you'd like any help. You all are awesome 😄 |
👍 for being able to kill ember-dynamic-component and having it built-in. |
My initial pass is up at #10093 |
Hi All, |
this would be quite handy for building very dynamic pages, that generate various components based on dynamic data.
This may be addon material...
The text was updated successfully, but these errors were encountered: