1

I have an angular js app that I want to integrate into Magento 2 so I created require-js config like below

var config = {
    paths: {
            angular: 'Test_Custom/js/angular',
            angularroute: 'Test_Custom/js/angular-route',
            angularanimate : 'Test_Custom/js/angular-animate',
            app : 'Test_Custom/js/app',
            minecontroller : 'Test_Custom/js/mine-controller',
    },
    shim: {
        'angular': {
            exports: 'angular'
        },
        'angularroute':{
            deps:['angular']
        },
        'angularanimate':{
            deps:['angular']
        },
        'app': {
            deps: ['angular','angularroute']
        },
        'minecontroller': {
            deps: ['angular','app']
        }
    }
};

and added this script in a template file

<script>
  require(['jquery' , 'jquery/ui','app','minecontroller'], function () {
   });
</script> 

JS files are getting loaded as per dependencies but, I am getting error -

Failed to instantiate module Mine due to Module 'Mine' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Is there anything I have to change in the shim config?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.