After spending a considerable amount of time analyzing every line of code, I can't seem to pinpoint any errors. Here is what I have:
HTML:
<body ng-app='myApp'>
<div class="wrapper">
<nav>
<ul ng-controller="pathController">
<li ng-click="changePath('about')"><a href="#about">About</a></li>
<li ng-click="changePath('contacts')"><a href="#contacts">Contacts</a></li>
<li ng-click="changePath('login')"><a href="#login">Log In</a></li>
<li ng-click="changePath('register')"><a href="#register">Join Now</a></li>
</ul>
</nav>
</div>
<script src="node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
<script src="node_modules/angular/angular.min.js" type="text/javascript"></script>
<script src="node_modules/angular-route/angular-route.min.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>
<script src="scripts/controllers/pathController.js" type="text/javascript"></script>
</body>
app.js:
var app = angular.module("myApp", ['ngRoute', 'ngController']);
app.config(["$locationProvider", "$routeProvider"],
function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix("");
$routeProvider.when('/', {
templateUrl: "index.html"
})
})
I later added the 'ngController' dependency while troubleshooting various things that might solve the issue.
and pathController.js:
app.controller('pathController', function($scope) {
$scope.changePath = function(pth) {
window.location.pathname = pth;
}
})
From my observation, it seems like $routeProvider is not causing the problem. Could you please review and assist in resolving this issue?
P.S. I forgot to mention the error I am encountering in the content, but I highlighted it in the title. Here it is:
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.7.4/ ...
Your help is greatly appreciated!