There is a strange issue occurring in my code where I have two main HTML pages
index.html && adHome.html
Both these pages use different routes. However, on trying to configure Angular, the following code snippets were used:
angular
.module('App', [
'ngRoute',
'ngAnimate',
'ngCookies',
'ngResource',
'ngTouch',
'ngSanitize'
])
.config(function ($routeProvider) {
$routeProvider
.when('/test', {
templateUrl: 'views/user/main.html', //included in index.html
controller: 'MainCtrl'
})
.when('/Reports', {
templateUrl: 'pages/Reports.html', //included in adHome.html
controller: 'reportController'
})
.otherwise({
redirectTo: '/404' //used by both
});
}
Running the pages on index.html works perfectly fine. However, when attempting to run something on adHome.html, an error occurs:
Failed to instantiate module flowersApp due to: Error: [$injector:modulerr] http://errors.angularjs.org/1.5.8/$injector/modulerr?p0=n...)...
The issue seems to be that adHome.html does not include the following modules:
"'ngAnimate', 'ngCookies', 'ngResource', 'ngTouch', 'ngSanitize"
This causes errors to occur. Removing them resolves the issue on adHome.html but results in errors on index.html due to missing injections.
If anyone could provide assistance in resolving this matter, it would be greatly appreciated.