I try to use swipe-pages by template repeat.
<swipe-pages>
<template is="dom-repeat" items="{{values}}">
<swipe-page>
<div>
Text to swipe
</div>
</swipe-page>
</template>
</swipe-pages>
In the polymer I wrote
created: function() {
console.log(this);
this.values = [1,2,3];
}
It give me the error
Uncaught TypeError: Cannot set property 'values' of undefined
Polymer.created
Polymer.Base._addFeature._invokeBehavior
Polymer.Base._addFeature._doBehavior
Polymer.Base.createdCallback
window.Polymer
(anonymous function)
Polymer.DomApi.DomApi._addNode
I cant get it work.
Also use
ready:function(){this.values=[1,2,3];};
does not work. in this case it throws exception that their is 0 pages.
I think that the the swipe-pages does not receive the input after the template repeat run.
If I write it not by template it works ok..
update:
this is all the polymer-element.
<dom-module id="element-element">
<template>
<swipe-pages>
<template is="dom-repeat" items="{{values}}">
<swipe-page>
<div>
text
</div>
</swipe-page>
</template>
</swipe-pages>
</template>
<script>
Polymer({
is:'element-element',
created: function() {
this.values = [1,2,3];
},
ready: function(){
this.values=[1,2,3];
}
});
</script>
</dom-module>
If their is another swipe page element for polymer that can dynamically change I will be happy to know.
If their is a hack solution (like load all the element dynamically) it will be also ok
Thanks.
ready
callback instead (ready: function() {}
) – Saponifythis.values
? Can you share more code please? – Saponifyswipe-pages
are you using? Is it Polymer 1.0 compatible? – Andreyswipe-pages
is blocking you -<content id="pages" select="swipe-page"></content>
...It can't selectswipe-page
because when it tries togetDistributedNodes()
it returns an empty array, that is, zero pages. So the fix will require either a pull request toswipe-pages
or use an alternative. – Saponifyneon-animated-pages
as an alternative solution? – Saponify