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

Dynamically added elements don't get data-binded #2477

Closed
avdaredevil opened this issue Sep 24, 2015 · 7 comments
Closed

Dynamically added elements don't get data-binded #2477

avdaredevil opened this issue Sep 24, 2015 · 7 comments

Comments

@avdaredevil
Copy link

I have a dashboard form of an app that is fully written in Polymer, however when I AJAX fetch a sub page within the app, I create elements that need to be binded in relation to the app, I was able to get around this problem by nesting dom-binds [which allowed for a second scope]
To get the parent template values binded I also make in the parent template.

However these only work if the listeners were already in my main app file and not created after the AJAX call.

So Polymer has an issue with not being able to create data-binding with elements created dynamically.

@zoechi
Copy link

zoechi commented Sep 25, 2015

Can you please add some more code? How do you add the element?

@zerodevx
Copy link

Polymer 1.0+ does not support imperative data-binding. Because bindings are baked during element registration time. Only exception of late-bind is in a <template is="dom-bind"> instance. You might find this #2131 and this #1778 useful.

@avdaredevil
Copy link
Author

Is there a way to expose the polymer API, so that the same logic can be applied to a custom element. This way polymer can still act as a usable front end framework?

@ebidel
Copy link
Contributor

ebidel commented Sep 25, 2015

#1778 is for exposing that API. Please use declarative bindings for now.
That's the recommend approach anyways.

On Fri, Sep 25, 2015, 6:34 AM Apoorv Verma [AP] notifications@github.com
wrote:

Is there a way to expose the polymer API, so that the same logic can be
applied to a custom element. This way polymer can still act as a usable
front end framework?


Reply to this email directly or view it on GitHub
#2477 (comment).

@ebidel ebidel closed this as completed Sep 25, 2015
@4dinterface2
Copy link

Unable to write the generators forms. I can`t foresee all possible controls in the template. Controls at me as plug-ins are connected .

@syntax42
Copy link

I must say that i think this is the biggest limitation i have found in Polymer: Not being able to databind to dynamically created elements. For a one page webapp, like the one i am currently developing, there is simply no way to know from page load, what or how many elements is needed in the entire life time of the session. :-(

@AliMD
Copy link
Contributor

AliMD commented Aug 18, 2016

I hope this code useful: #1778 (comment)

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

7 participants