AngularJS路由不能正常工作,甚至尝试CDN

1)我可以看到url中的更改,但该页面中的文本在ng-view中不可见,请帮助。

    **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/30979.html

上一篇: Angular js routing not working properly, tried even CDN

下一篇: Page doesn't redirect to the specified page on invalid url