I'm trying to use routing in angularJS and I've been able to set most of it using w3schools as a tutorial. The problem is that w3schools doesn't provide example files for their external htm files. here's what I have JavaScript:
var app = angular.module('myApp', ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "librarian.html"
});
});
app.controller('myCtrl', function($scope)
{
});
main HTML:
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>
<script src="./library.js"></script>
<body ng-app="myApp" ng-controller="myCtrl">
<p id = "loginScreen" >
username: <input id = "userName" name = "userName" ng-model="name"><br>
password: <input id= "password" name = "password" ng-model="password"><br>
<input type = "button" value = "login" id = "loginButton" ng-click="login()">
<a href="#librarian">librarian</a>
</p>
<script type = "text/ng-template" id = "librarian.htm">
<div>hello</div>
</script>
<div ng-view></div>
</body>
</html>
What do I need to do in librarian.html to get the page to switch to it (currently the URL changes, but all of the elements on the page remain the same)?