bind attribute replacement
Hi, I'm aware the bind attribute has been disabled on <template>s but after pouring through the docs on polymer-project.org, stackoverflow.com and the polymer source code I'm not sure how to port the same functionality to Polymer 1.0. As I understand it the bind attribute allows you to scope to properties inside of a template.
So with this code snippet I would expect name to become "test" (if bind was ported from Polymer 0.5), but I'm not sure how to apply this scoping in Polymer 1.0. I know I could just do {{data.name}} but unfortunately my use case is a bit more complex and that won't work. Could you please advise on how to achieve this? My element is supposed to be a file treeview, which either requires an indefinite number of dom-repeats or scoping like this.
<dom-module is="example-elem">
<template>
<template bind="{{data}}">
<div>{{name}}</div>
</template>
</template>
</dom-module>
<script>
Polymer({
is: 'example-elem',
properties: {
data: {
type: Object,
value: {
name: "test"
}
}
}
}
</script>
@winhowes Do you want followings code :-1:
<dom-module id="example-elem">
<template>
<span>[[ data.name ]]</span>
</template>
</dom-module>
<script>
Polymer({
is: 'example-elem',
ready: function() {
this.data.name = "Polymer";
},
properties: {
data: {
type: Object,
value: {
name: ""
}
}
}
});
</script>
<template is="dom-bind">
<example-elem data="{{ data }}"></example-elem>
</template>
I guess my broader question was if it was possible to do recursion, but I believe I have found an answer: https://stackoverflow.com/questions/30468581/polymer-recursive-template-binding/30469213#30469213. I'll close this