-
Notifications
You must be signed in to change notification settings - Fork 29
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
Setting default data to template[is="dom-bind"] #51
Comments
I think I'm a little confused...why can't you just set the property on the template? i.e. Secondly, if that doesn't work, you can just put the <template is="dom-bind" id="scope">
<demo-snippet>
<template>[[scope.someText]]</template>
</demo-snippet>
</template>
<script>
scope.someText = 'meow'
</script> |
Setting the value is easy. What I wanted more is actually showcasing the values. See the screenshot in my PR. I added an additional |
How would this work with polymer 2 ?
|
Description
It is possible to use data binding in the
demo-snippet
template but there is no simple way for setting initially bound values.Expected outcome
Setting up data binding without resorting to
document.querySelector
etc. to select the<template>
instance. Also, it would be nice to then display the bound data inmarked-element
along the demoed element(s). Here's how I imagine the usageFor lack of a better idea, I assume that there has to be a global function named same as the snippet's template. If so, then the data returned from this function will be assigned to
template.data
property. Alternatively, I'm considering iterating the keys of the object and setting on the template so that it won't be necessary to prefix everything withdata.
Also, I that in addition to a function, a variable could be set up in the script like
window.defaultBinding = {}
I'm also not too keen on the idea of global function/variable. I'd like to hear any suggestions.
Browsers Affected
The text was updated successfully, but these errors were encountered: