Skip to main content

All Questions

Filter by
Sorted by
Tagged with
16 votes
6 answers
32k views

How to get the base url from a JS file?

I want to retrieve a base URL and append it with my module controller link from a JS file, so it's impossible to use a block to get the base URL. So far I've done this: define([ 'jquery', 'mage/...
simple guy's user avatar
  • 2,494
2 votes
2 answers
9k views

Module JS - Mismatched anonymous define module

I've tried adding my module JS file to Magento2 but for whatever reason it seems to return this error: Error: Mismatched anonymous define() module: function($) My view/frontend file structure: |-...
treyBake's user avatar
  • 141
2 votes
3 answers
3k views

Magento 2: Adding JS from module

I have a module, and I want to add a javascript generated in the module at the frontend footer. The javascript has to be built dynamically because it depends on server variables. I've thought of a ...
Miguel's user avatar
  • 569
4 votes
3 answers
5k views

Is there a some solution to use npm packages within a Magento 2 module?

The main idea - don't keep JS files which belong to some NPM packages in a module repository? Maybe someone have some solution of thoughts.
Kirby's user avatar
  • 743
2 votes
1 answer
13k views

How to add JS messages from custom module?

How do I add messages using Magento 2 Ui messages to page via javascript from a custom module? I have found a file in Magento/Ui/view/frontend/web/js/view/messages.js that appears to be responsible ...
LM_Fielding's user avatar
  • 1,563
0 votes
3 answers
3k views

Uncaught TypeError: $el.ColorPicker is not a function Magento 2

Magento ver. 2.0.18 I created a custom module in backend there is color picker options. for this i used this link color picker answer of @EmizenTech it works perfectly but some time it gives and if ...
inrsaurabh's user avatar
  • 1,676