<script src="js/angular-ui-router.js"></script>
<ul> <li><a ui-sref="index">首页</a></li> <li><a ui-sref="fruit">水果</a></li> <li><a ui-sref="vegetable">蔬菜</a></li> </ul>
angular.module('myapp',['ui.router'])
.config(function($stateProvider,$urlRouterProvider){
$urlRouterProvider.otherwise('/index');
$stateProvider.state('fruit',{
url:'/fruit',
templateUrl:'fruit.html'
})
.state('vegetable',{
url:'/vegetable',
templateUrl:'vegetable.html'
})
.state('index',{
url:'/index',
template:'<h2>这是首页</h2>'
});
});
.state('vegetable',{
url:'/vegetable',
templateUrl:'vegetable.html'
})
.state('index',{
url:'/index',
template:'<h2>这是首页</h2>'
});
<ul> <li><a ui-sref="fruit.orange">橘子</a></li> <li><a ui-sref="fruit.apple">苹果</a></li> <li><a ui-sref="fruit.banana">香蕉</a></li> </ul> <div ui-view></div>
$stateProvider.state('fruit',{
url:'/fruit',
templateUrl:'fruit.html'
})
.state('vegetable',{
url:'/vegetable',
templateUrl:'vegetable.html'
})
.state('index',{
url:'/index',
template:'<h2>这是首页</h2>'
})
.state('fruit.orange',{
url:'/orange',
templateUrl:'orange.html',
})
.state('fruit.apple',{
url:'/apple',
templateUrl:'apple.html'
})
.state('fruit.banana',{
url:'/banana',
templateUrl:'banana.html'
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有