6

In a ko template (abc.html) I have the following

<div data-mage-init='{"a_script":{} }'></div>. 

I made sure that requirejs-config.js loaded the correct config

'a_script' : 'namespace/js/a_script' 

and that "a_script.js" file exists. At runtime, abc.html gets loaded but the data-mage-init is not initialized or run.

magento68
  • 167
  • 2
  • 10

1 Answers1

10

I managed to accomplish this with M2's mageInit databind

<div data-bind='mageInit: {"a_script":{}}'></div>
magento68
  • 167
  • 2
  • 10