I don't know what the term would be in Polymer but I want to pass data from one polymer element to another element that it is using inside it.
<dom-module id="bw-boat-form">
<template>
<paper-material class="material-container" elevation="1">
<h2></h2>
<form is="iron-form">
<bw-image-upload image$="" ></bw-image-upload>
</form>
</paper-material>
</template>
<script>
Polymer({
is: 'bw-boat-form',
properties: {
data: {
type: Object
},
save: {
type: Boolean
},
update: {
type: Boolean,
value: false
}
}
});
</script>
</dom-module>
And the image upload element
<dom-module is="bw-image-upload">
<template>
<iron-image class="image" preload placeholder="/images/icons/placeholder.jpg" sizing="cover"></iron-image>
<vaadin-upload
target="/images/upload"
max-files="1"
max-file-size="200000"
accept="image/*"
upload-success="uploadResponseHandler"
file-reject="errorHandler"
>
</vaadin-upload>
</template>
<script>
Polymer({
is: 'bw-image-upload',
ready: function() {
console.log(image);
},
uploadResponseHandler: function() {
},
errorHandler: function() {
}
})
</script>
</dom-module>
I want to pass down the value of the from the first element into the second element so that I can change the image of the placeholder when needed. How can I achieve this ?
Aucun commentaire:
Enregistrer un commentaire