Error when creating Views js component #90
-
Hi @vovayatsyuk I am trying to create a Views component but getting errors
I have create view file with below code: `(function () {
})();` Added in like below: <script type="text/x-magento-init"> { "*": { "Magento_Theme/js/test-view": {} } } </script>Please help me with this. Thanks, |
Beta Was this translation helpful? Give feedback.
Answered by
vovayatsyuk
Apr 10, 2023
Replies: 1 comment 2 replies
-
The file is calling and the alert is working but still giving error which mention above |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The issue is caused by your View not being attached to any DOM element. Usually, there should be a DOM element with a
scope
attribute to make it work (data-bind="scope: 'wishlist'"
)Since you do not render anything/using DOM you don't need a view or widget, I think you should use raw js file in this case. Take a look at theme.js for example.