0

I have call custom template file in UI component and try to call knockout js in custom template but it won't call, I have built it like this. Please let me know if anyone has an idea.

Feed/view/adminhtml/templates/feedimages/file.phtml

<h2>Emipro Knockout template call here..</h2>

<script type="text/x-magento-init">
    {
        "*": {
            "Module_Shoppingfeed/js/jsfile": {
                "uploadUrl": "test",
                "feedMedia": "test1234"
            }
        }
    }
</script>

jsfile.js

    define(['ko'], function(ko) {
        return function(config) {
            this.message = ko.observable(config.exampleMessage);
        }
    });
6
  • What is the console error you got? – Ranganathan Sep 9 '19 at 8:32
  • not geeting any error and not calling js file in Network.. – Niranjan Gondaliya Sep 9 '19 at 9:00
  • Can you pls post your xml code....which is calling your js file? – Ranganathan Sep 9 '19 at 9:21
  • calling js from PHTML file – Niranjan Gondaliya Sep 9 '19 at 10:23
  • i think you should call any js function by creating Uicomponent by xml – Ranganathan Sep 9 '19 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.