Data binding/updating between parent and child using <content> tag in Polymer1.0

爱⌒轻易说出口 提交于 2019-11-29 08:58:07

Here is a fork of your current plunkr. I've made two changes to it.

  • Engulfed index.html in dom-bind so that polymer bindings can work.
  • Replaced hard coded value of current-image for phone-carousel with binding, so that it can be updated on-hover

Hopefully this is what you were looking for.

you are not setting currentImage to custom-slider but only to custom-slide. So inside custom-slider you won't fint that property. That's the problem propably you are looking for.

edit your code to:

<custom-slider current-image="{{currentImage}}">
   <custom-slide current-image="{{currentImage}}"></custom-slide>
   <custom-slide current-image="{{currentImage}}"></custom-slide>
   <custom-slide current-image="{{currentImage}}"></custom-slide>
</custom-slider>

EDIT

The problem is that you can't do these things in index.html you need to wrap it into another file that will store currentImage property and notify about changes. So the only thing i did, was to wrap everything you had in index.html into new file which I called wrapper-elements (change it to watever you want) I also edited something to make it more simple, so don't do ctrl+c and ctrl+v. Just copy wrapper-elements element only.

Here is working plnkr: https://plnkr.co/edit/eElf4H6CQOVhahShyjBF?p=preview (I hope it's right link. I have never did something in plnkr)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!