Skip to content

Commit 80a91d9

Browse files
Merge pull request #50 from Tjitse-E/fix/remove-knockout-advice
fix: remove include knockout via layout xml step
2 parents c1757d5 + 918d612 commit 80a91d9

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

knockoutjs-integration.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ beneficial as well.
1919

2020
To integrate KnockoutJS into your Magento 2 project, follow these steps:
2121

22-
1. Include KnockoutJS library: Add the KnockoutJS library to your project by including the following line in your
23-
template file or layout XML:
24-
```html
25-
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
26-
```
27-
28-
2. Create a View Model: A view model is a JavaScript object that represents the data and behavior of your UI components.
22+
1. Create a View Model: A view model is a JavaScript object that represents the data and behavior of your UI components.
2923
In Magento 2, you can define a view model in a separate JS file or inline within a script tag. Here's an example of
3024
defining a view model inline:
3125
```html
@@ -39,13 +33,13 @@ To integrate KnockoutJS into your Magento 2 project, follow these steps:
3933
</script>
4034
```
4135

42-
3. Bind Data to the UI: To bind data from the view model to the UI, use KnockoutJS data binding syntax. You can use
36+
2. Bind Data to the UI: To bind data from the view model to the UI, use KnockoutJS data binding syntax. You can use
4337
the `data-bind` attribute on HTML elements to specify the binding. For example:
4438
```html
4539
<div data-bind="text: message"></div>
4640
```
4741

48-
4. Handle User Interactions: KnockoutJS provides a set of event bindings to handle user interactions. You can use
42+
3. Handle User Interactions: KnockoutJS provides a set of event bindings to handle user interactions. You can use
4943
the `click`, `submit`, `event`, and other bindings to attach event handlers to HTML elements. Here's an example of
5044
handling a click event:
5145
```html

0 commit comments

Comments
 (0)