I am trying to switch the view, once the "Add" button is clicked (see code below). However, when I click on button "Add", the only thing that happens is that the "/addRecordType" is attached to the end of my URL in the browser, instead of resolving it to 'templates/add-record-type.html' as config instructs it to do. Why is this happening and how could I make it work? Thanks!
parserconfig.html
<!DOCTYPE html>
<html ng-app='parserconfigApp'>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://code.angularjs.org/1.3.14/angular-route.min.js"></script>
<title>Parser Config</title>
</head>
<body>
<div ng-controller='ParserConfigController as parserConfig'>
<button ng-click="changeView('addRecordType')">Add</button>
</div>
<script type="text/javascript" src="parserconfigApp.js"></script>
</body>
</html>
parserconfigApp.js
var app = angular.module('parserconfigApp', ['ngRoute']);
app.controller('ParserConfigController', ['$scope', '$location', function($scope, $location){
$scope.changeView = function(view) {
$location.path(view);
}
}]);
app.controller('AddRecordTypeController', ['$scope', function($scope){
}]);
app.config('$routeProvider',
function($routeProvider) {
$routeProvider.
when('/recordTypeList', {
templateUrl: '/parserconfig.html',
controller: 'ParserConfigController'
}).
when('/addRecordType', {
templateUrl: 'templates/add-record-type.html',
controller: 'AddRecordTypeController'
}).
otherwise({
redirectTo: '/recordTypeList'
});
});