码迷,mamicode.com
首页 > 其他好文 > 详细

angular-ui-router

时间:2017-11-23 12:21:18      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:control   play   注入   col   img   ext   asc   初始化   模板   

1.简单示例

技术分享图片
 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

 

<html><head><title>ui-router</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!-- 导入JS --><script type="text/javascript" src="JS/angular.min.js"></script><script type="text/javascript" src="JS/angular-ui-router.min.js"></script></head><body ><div ng-app="myApp"><div ui-view></div><!-- 视图 --></div></body><script type="text/javascript"> //定义模板,并注入ui-router var app = angular.module(‘myApp‘, [‘ui.router‘]); //对服务进行参数初始化,这里配stateProvider服务的视图控制 app.config(["$stateProvider", function ($stateProvider) { $stateProvider .state("home", { url: ‘/‘, template:‘<div>模板内容......</div>‘ }) }]); </script></html>

angular-ui-router

标签:control   play   注入   col   img   ext   asc   初始化   模板   

原文地址:http://www.cnblogs.com/Jerry-MrNi/p/7883983.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!