Angular js routing not working properly, tried even CDN
1)I can see changes in the url but the text in that page is not visible in ng-view please help.
**Angular script**
var app = angular .module("myapp", ["ngRoute"]) .config(function ($routeProvider) { $routeProvider .when("/Home", { templateUrl: "Home.html", }) .when("/ThankYou", { templateYrl: "ThankYou.html", }) }) **Html code**
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script src="angular.min.js"></script>
<script src="angular-route.js"></script>
<title></title>
</head ng-app="myapp">
<body>
<div>
<a href="#/Home">Home</a>
<a href="#/ThankYou">ThankYou</a>
</div>
<div ng-view></div>
</body>
</html>
**Home.html**
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div>
Home
</div>
</body>
</html>
[enter image description here][1]
[1]: https://i.stack.imgur.com/KKt8u.png
var app = angular.module("Demo", ['ngRoute']);
app.config(function($routeProvider) {
$routeProvider
.when('/Home', {
templateUrl: 'Home.html',
controller: 'FirstController'
})
.when('/ThankYou', {
templateUrl: 'ThankYou.html',
controller: 'SecondController'
})
});
app.controller('FirstController', function($scope) {
});
app.controller('SecondController', function($scope) {
});
DEMO
链接地址: http://www.djcxy.com/p/30980.html