I'm a beginner in angular. My routes do not load in ng-view. When I click on the link my url looks like this
link and nothing happens.
No error is displayed on the console.
I use angle 1.6.
test.js
var MyApp = angular.module("MyApp", ['ngRoute']);
MyApp.config(function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$routePriveder.
when('/add', {
templateUrl: 'Paginas/add.html',
controller: 'AddController'
}).
when('/edit', {
templateUrl: 'paginas/edit.html',
controller: 'EditController'
}).
when('/delete', {
templateUrl: 'paginas/delete.html',
controller: 'DeleteController'
}).
when('/home', {
templateUrl: 'paginas/home.html',
controller: 'HomeController'
}).
otherwise({
redirectTo: '/home'
});
});
controllers.js
MyApp.controller("AddController", function ($scope) {
$scope.msg= "Add";
});
MyApp.controller("EditController", function ($scope) {
$scope.msg = "Editar";
});
MyApp.controller("DeleteController", function ($scope) {
$scope.msg= "deletar";
});
Index.html
<!DOCTYPE html>
<html ng-app="MyApp">
<head>
<title></title>
<meta charset="utf-8" />
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/jquery-1.10.2.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-route.js"></script>
<script src="test.js"></script>
<script src="controllers.js"></script>
</head>
<body>
<nav role="navigation" class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#"> O que Tem Pra Hj? </a>
</div>
<ul class="nav navbar-nav">
<li><a href="#home">Home</a></li>
<li><a href="#add">Add</a><li>
<li><a href="#edit">Edit</a></li>
<li><a href="#delete">Delete</a></li>
</ul>
</div>
</nav>
<div ng-view> </div>
</body>
</html>
add.html
<h2 ng-controller="AddController">{{msg}}</h2>