引入<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
 1 <html>
 2   <head>   
 3     <title>ui-router</title>
 4     <meta http-equiv="pragma" content="no-cache">
 5     <meta http-equiv="cache-control" content="no-cache">
 6     <meta http-equiv="expires" content="0">    
 7     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 8     <meta http-equiv="description" content="This is my page">
 9     <!-- 导入JS -->
10     <script type="text/javascript" src="JS/angular.min.js"></script>
11     <script type="text/javascript" src="JS/angular-ui-router.min.js"></script>  
12   </head>
13 
14   <body >   
15     <div ng-app="myApp">        
16         <div ui-view></div> <!-- 视图 -->     
17     </div>  
18   </body>
19 
20 
21   <script type="text/javascript">
22     //定义模板,并注入ui-router
23     var app = angular.module('myApp', ['ui.router']);   
24     //对服务进行参数初始化,这里配stateProvider服务的视图控制
25     app.config(["$stateProvider",  function ($stateProvider) {      
26         $stateProvider     
27         .state("home", {
28             url: '/',   
29             template:'<div>模板内容......</div>'
30         })     
31     }]);  
32   </script>
33 
34 </html>
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2021-10-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案