<ng-view [onload=”string”] [autoscroll]=”string”></ng-view>
when( path, route); 用于在访问 path 路径时,跳转到 route 指定的视图 |-- path:路由跳转的径 |-- route:路由对象 <组件 对象 >,一个 JSON对象 otherwise(params);用于在访问不存的路径时,跳转的默认路径或者视图 |-- params:指定路径或者路由对象
<div ui -viewviewviewview></div>> <ui -view></uiview>
var app = angular.module(“myApp", ['ngRoute']);
app.config(["$routeProvider",function($routeProvider){
}]);
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>ui-route</title>
<script src="js/lib/angular.min.js" ></script>
<script src="js/lib/angular-ui-router.min.js"></script>
</head>
<style type="text/css">
.active{
color:red;
font-weight:bold;
}
</style>
<body>
<ul>
<li><a ui-sref="hello" ui-sref-active='active'>Hello</a></li>
<li><a ui-sref="world" ui-sref-active='active'>world</a></li>
</ul>
<div>
<ui-view></ui-view>
</div>
</body>
<script>
var app=angular.module("myApp",["ui.router"]);
/*
$stateProvider: Ui路由中的状态服务提供者
*/
app.config(["$stateProvider","$urlRouterProvider",function($stateProvider,$urlRouterProvider){
$urlRouterProvider.otherwise("/hello");
$stateProvider.state({
name:"hello",
url:"/hello",
template:"<h1>这是hello对应的内容</h1>"
}).state({
name:"world",
url:"/world",
template:"<h1>这是world跳转之后对应的内容</h1>"
});
}]);
</script>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有