I have server logs that show a client is loading all of the modules required in my ng-app = M
declaration attached to the <html>
element. Meaning, all of the dependencies seem to be loaded correctly before my app is declared and initialized.
My app looks like this:
var app = angular.module('M', ["ui.router",'ui.bootstrap','angular.media','chart.js','ngMessages','ngTouch']);
The module reported to my server as the cause of the Module Unavailable
error is angular.media
even though I can see the following in the server log:
XX.XX.X.XXX - - [13/Dec/2017:19:31:24 +0000] "GET /getScript/angular-media.js?v=7.1.7 HTTP/1.1" 200 5172 "https://example.com/home" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/6.1.6 Safari/537.78.2"
XX.XX.X.XXX - - [13/Dec/2017:19:31:25 +0000] "GET /getScript/authapp.js?v=9.2 HTTP/1.1" 200 1449 "https://example.com/home" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/6.1.6 Safari/537.78.2"
I believe the error might have to do with the fact that angular.media
relies on ui.router
as well, which may be causing the issue? The ui.router
is loaded from the cache before reaching the /home
page.
angular.module('angular.media', ["ui.router"])
What is causing this issue do you think?
I can load the page fine so I am relying on reported errors to my server from this user but wondering if it is a problem with how I am doing Angular dependency injection.
Angular Url Error: HERE
First 10 lines of Angular Media:
angular.module('angular.media', ["ui.router"])
.controller('Controller', ['$scope', function($scope) {
}])
.directive('angularmedia', [
'$angularMediaStack',
function($mediaStack) {
return {
restrict: 'A',
template:'<div class="someClass"><angularmediabar></angularmediabar><div class="earParagraph"><rewind></rewind><play></play><fastforward></fastforward></div></div>',
controller: function($scope, $element,$attrs) {
I am wondering if there is a better way I could be logging and debugging this, since I can't reproduce on my own implementation.
Since the server log indicates the script is being loaded, is it something with how I am trying to record the client-side error? I am using this code:
window.onerror = function (message, url, lineNo) {
try {
var request = new XMLHttpRequest();
var formData = new FormData();
formData.append("message", message);
formData.append("url", url);
formData.append("line", lineNo);
request.open("POST", "/errors");
request.send(formData);
} catch (s) {}
return true;
};
Furthermore: this is the order of the script load on /home
<script src="https://example.com/js/jquery.min.js"></script>
<script src="https://example.com/js/bootstrap.min.js"></script>
<script src="https://example.com/js/jquery.scrollex.min.js"></script>
<script src="https://example.com/js/jquery.transit.min.js"></script>
<script src="https://example.com/js/angular.min.js"></script>
<script src="https://example.com/js/angular-animate.min.js"></script>
<script src="https://example.com/js/ui-bootstrap.min.js"></script>
<script src="https://example.com/js/angular-ui-router.min.js"></script>
<script src="/js/angular-messages.js"></script>
<script src="/js/angular-touch.js"></script>
<script src="/getScript/angular-media.js?v=7.1.7"></script>
<script src="/getScript/Chart.js"></script>
<script src="/getScript/angular-chart.js"></script>
<script src="/getScript/moment.js"></script>
<script src="/getScript/owl.carousel.min.js"></script>
<!--HTML Content-->
<script src="/getScript/authapp.js?v=9.2"></script>
<script src="/getScript/authconfig.js?v=9.2"></script>
<script src="/getScript/authservices.js?v=9.2"></script>
<script src="/getScript/authdirectives.js?v=9.2"></script>
<script src="/getScript/authcontrollers.js?v=9.2.9.2"></script>
<script>
app.factory('AboutMe', [function() {
//fill with PHP derived values
}]);
</script>
The user loads ui.router
from the landing page and it stays in the cache. Then the IP changes, they go to the homepage, and the error as I have stated Module Unavailable (angular.media) is reported to my server using the reporting code I gave above.
Again, I cannot reproduce this error myself and it happens occasionally to various users at different times (never more than one or two at a time) before resolving itself, but it is becoming a big pain.
Please advise as to what could be causing this or how I can better reproduce.