How to use foreach loop with the array and objects in knockout js magento?

knockout Javascript with Foreach loops for the observable array and objects with the data-bind property of the DOM tag.

Let’s start with a simple for each loop with an array that contains the numbers only,

JS file contains the knockout declaration of the observable array, called getNumbers property, Continue reading “How to use foreach loop with the array and objects in knockout js magento?”

How to define Require JS Plugin in Magento?

You can create Require JS plugin in Magento with text! as a suffix and pass HTML file path in the dependency of the define( ) method in javascript.

An Example of a text plugin in Magento,

Continue reading “How to define Require JS Plugin in Magento?”

How to define knockout property as observable in Magento 2?

Magento uses knockout Javascript to enhance some of its native features. You must have to know about the Knockout observable feature to use it.

knockout observables are used to get track changes of the current view model property. if you want to subscribe to a change of your view model objects, you must define your property or objects as observable. Continue reading “How to define knockout property as observable in Magento 2?”