[angularJS]An example about angular-ui-router

2015-9-16 写技术

<html ng-app='myApp'>
<script src="js/angular.min.js" ></script>
<script src="../framework/angular-ui-router.js"></script>
<!-- in index.html -->
<body >
<section ui-view></section>
</body>
<script>
angular.module('myApp', ['ui.router']).config( function( $stateProvider){

 $stateProvider
  .state('contacts', {
   url:'/contacts',
     template: '<h1>My Contacts</h1>'
  })
  .state('page1', {
   url:'/page1',
   templateUrl:'template/page-1.html' 
  });

});
</script>
</html>

标签: angularJS

发表评论:

Powered by anycle 湘ICP备15001973号-1