0

I am trying to add a functionality in magento2 using Angular. But every time I run the page it gives this error

Uncaught Error: [$injector:modulerr] Failed to instantiate module MbApp due to: Error: [$injector:nomod] Module 'MbApp' 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.

then after Hard Reload and Clear Cache it works.

These are my scripts

<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/angularjs/angular.js"></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/angular-sanitize/angular-sanitize.js"></script>  
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/ng-file-upload/angular-file-upload.js" ></script>                                                                                          
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/fancybox/source/jquery.fancybox.js" ></script>                                                                                            
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/fabric/dist/fabric.js" ></script>  
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/mb-app.js" ></script>                                                                                        
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/canvas.js" ></script> 

I tried with angular cdn but that didn't work. So why it's not working at first time but after multiple reloads.

1 Answer 1

0
This means that some module is failing to load.
Please take a look at your browser's console to see if any files are not being downloaded correctly.
Also it helps if you click on the link to http://errors.angularjs.org at the bottom as it might give you more information about which particular module is failing to load.

The snippet that you have provided has the rest of the URL hidden so it is hard to see what is going on.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.