I am encountering an issue when trying to asynchronously download the Angular script in my application and manually bootstrap the application upon loading. The error message states: Failed to instantiate module wt due to: Error: [$injector:modulerr] http://errors.angularjs.org/1.4.5/$injector/modulerr?p0=y...) at Error (native) at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js:6:416 at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js:38:98 at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js:7:322) at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js:37:180) at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js:37:349 The code I am using is as follows:
window.onload = function(){
app = angular.module('wt', ['ngRoute']);
app.config(function ($routeProvider,$locationProvider) {
$routeProvider
.when('/', {
controller: 'homeController',
templateUrl: 'template/home.html?ver='+file_version
})
.otherwise({ redirectTo: '/'});
$locationProvider.html5Mode(true);
});
angular.module('wt').controller('homeController', function(){alert('Hello World');});
angular.bootstrap(document, ['wt']);
};
For the script tags, I have included the following:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js" async></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular-route.min.js" async defer></script>
I would appreciate any assistance in identifying what might be causing this error. Thank you.