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

Angular 添加路由

时间:2017-08-04 12:49:23      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:dir   html   start   tail   tar   out   red   文件   文件名   

var app=angular.module(‘kaifanla‘,[‘ng‘,‘ngRoute‘]);
app.config(function($routeProvider){
//添加路由
$routeProvider
.when(‘/文件名‘,{
templateUrl:‘tpl/start.html‘,
controller:‘startCtrl‘
})
.when(‘/文件名‘,{
templateUrl:‘tpl/main.html‘,
controller:‘mainCtrl‘
})
.when(‘/文件名‘,{
templateUrl:‘tpl/detail.html‘,
controller:‘detailCtrl‘
})
.when(‘/文件名/:id‘,{
templateUrl:‘tpl/detail.html‘,
controller:‘detailCtrl‘
})
.when(‘/文件名‘,{
templateUrl:‘tpl/order.html‘,
controller:‘orderCtrl‘
})
.when(‘/文件名/:id‘,{
templateUrl:‘tpl/order.html‘,
controller:‘orderCtrl‘
})
.when(‘/文件名‘,{
templateUrl:‘tpl/myOrder.html‘,
controller:‘myOrderCtrl‘
})
.otherwise({redirectTo:‘/文件名‘});
});

Angular 添加路由

标签:dir   html   start   tail   tar   out   red   文件   文件名   

原文地址:http://www.cnblogs.com/dianzan/p/7284340.html

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