How to get gallery images in knockoutjs in Magento2.3.0?
Any help would be appreciated.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow to get gallery images in knockoutjs in Magento2.3.0?
Any help would be appreciated.
You need to pass it to your component via the PHTML file, add this to your PHTML file:
<script type="text/x-magento-init">
{
".yourSelector": {
"yourComponentAliasORPath": {
"galleryImagesJson": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>,
}
}
}
</script>
Then in your JS you can access it with this.config.galleryImagesJson
.
text/x-magento-init
tag and then in your JS you access it from this.config
Jan 10, 2020 at 12:13