angular.js - AngularJs通过定义锚点链接控制页面输出
大家讲道理
大家讲道理 2017-05-15 16:53:14
0
1
664
<!DOCTYPE html>
<html ng-app="ngView">
<head>
    <title>分页显示</title>
    <meta charset="utf-8">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> 
    <script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
</head>
<body>


<p ng-view>
    <p  ng-controller="test">
        
    </p>
</p>





<script type="text/javascript">
 angular.module('ngView', [],
    function($routeProvider){
      $routeProvider.when('/test1',
        {
          templateUrl: 'demo.html',
          controller: 'test'
        }
      )
      .when('/test2',
      {
        templateUrl:'slinder.html',
        controller: 'test'
      }
      );
    }
  );
</script>


</body>
</html>

挡在url中输出/#/test1时demo.html没有显示,请问是什么情况??

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
Peter_Zhu

Tell me a few questions
1: ng-app is generally written in the body
2: When defining routes, it is best to write them in a $routeProvider
3: Your routing definition is wrong. You only write the template without specifying the controller, which is also the reason why it does not work.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!