04.07.2019 Views

frontend-developer-1

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Customize and Create JavaScript<br />

<br />

In this example, the div tag will be bound directly to the UI component that is<br />

registered in the uiRegistry with the identifier estimation.<br />

Due to the complexity of this, I highly recommend doing some experimenting and<br />

watching Mage2.tv’s excellent series on Knockout and data binding.<br />

HELPFUL LINKS:<br />

• https://www.mage2.tv/content/javascript/<br />

• https://devdocs.magento.com/guides/v2.1/ui_comp_guide/<br />

concepts/knockout-bindings.html<br />

How do you render a ko template of a UiComponent?<br />

The UI Components on the checkout page provide a good example regarding how<br />

to specify the template used to be rendered.<br />

vendor/magento/module-checkout/view/<strong>frontend</strong>/web/js/view/<br />

payment.js<br />

Here is a basic UiComponent and template:<br />

// app/code/SwiftOtter/Flex/view/web/js/examplecomponent.js<br />

define([<br />

Copyright © 2018, SwiftOtter, Inc.<br />

93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!