I am new to Angular and I am having issues with Routing. When I go to localhost/index.html#/chatroom, it doesn't load Chatroom.html. Please consider the following files. Any help would be appreciated.
Following is my core.js file:
var messagingApp = angular.module('messagingApp',['ngRoute']);
function mainController($scope) {
console.log("yay");
}
function routing($routeProvider) {
$routeProvider.when('/chatroom', {
templateUrl : 'templates/ChatRoom.html',
controller : 'mainController'
});
}
messagingApp.config(routing);
messagingApp.controller('mainController',mainController);
Following is my index.html file:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css">
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>
<script src="js/User.js"></script>
<script src="js/core.js"></script>
<title>Real Time Chat</title>
</head>
<body ng-app="messagingApp">
<p>ss</p>
<div ng-view>
</div>
Following is my ChatRoom.html:
<div class="row">
<p>ssss</p>
<ul class="users">
<li ng-repeat="user in users">{{ user.UserName }}</li>
</ul>
</div>
Directory structure:
-js
core.js
-templates
ChatRoom.html
-index.html
Going to localhost/index.html#chatroom should load that file as per my understanding but it doesn't.