Reputation: 21
I ran into an issue over the weekend where all of a sudden the angularjs code on the website stopped working. No updates where made to any files during the time it was working and stopped working.
The error provided in the console is "Error: $injector:nomod Module Unavailable".
https://docs.angularjs.org/error/$injector/nomod?p0=bkApp
Here is the page that is broken now with the error - http://brookslaw.staging.wpengine.com/our-team/
Here is the header code:
<script async src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
<script async src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-route.min.js"></script>
<script async src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-sanitize.min.js"></script>
<script async src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-animate.min.js"></script>
<script async src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-cookies.min.js"></script>
<script async src="<?php echo get_template_directory_uri(); ?>/js/angular-lazy-img.min.js"></script>
<!--[if lt IE 9]>
<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/js/html5.js"></script>
<![endif]-->
<script async type="text/javascript">
var app = angular.module('bkApp', ['ngAnimate', 'angularLazyImg']);
</script>
<script>(function(){document.documentElement.className='js'})();</script>
The site was working just fine, and from the research I have done it appears that the module is called in correctly.
Thanks
Upvotes: 0
Views: 188
Reputation: 13753
I think your problem is in async
.
Basically, with it, your scripts are loaded asynchronously. Meaning that your script can be loaded before angularjs
loads, so you will have errors.
You need synchronous loading of your files. You need the correct order. So, remove async
from your scripts and try once more.
Hope it helps.
Upvotes: 2