September 2018
Beginner to intermediate
218 pages
4h 27m
English
Calling and initializing JS components might seem a bit challenging at first. There are two types of syntax notations used with Magento JS components:
To better understand the data-mage-init notation, let's take a look at a partial <PROJECT_DIR>/lib/web/mage/redirect-url.js file extract:
define([ 'jquery', 'jquery/ui'], function ($) { 'use strict'; $.widget('mage.redirectUrl', { options: { event: 'click', url: undefined }, _bind: function () { /* ... */ }, _create: function () { /* ... */ }, _onEvent: function ...Read now
Unlock full access