来源:http://docs.angularjs.org/api/ngRoute.$routeProvider
有省略。
$routeProvider
ngRoute模块中的服务
描述
用于配置路由
示例
配置与ngRoute的使用参见$route
依赖
需要安装ngRoute模块
方法
otherwise(params)
设置用于路由改变时,与任何其他路由定义无法匹配时使用的路由定义。
参数
参数名 | 类型 | 详细说明 |
params | Object | 将赋值给$route.current的映射信息 |
返回
[Object]自身
when(path, route)
为$route服务添加新的路由定义
参数
参数名 | 类型 | 详细说明 |
path | string |
(匹配$location.path的)路由地址。如果$location.path包含多余的尾斜杠或少了一个,路由仍会匹配,$location.path将会更新,增减一个斜杠以匹配路由定义。
例如,形如/color/:color/largecode/:largecode*/edit的路由,将会匹配/color/brown/largecode/code/with/slashs/edit,并提取出:
|
route | Object |
路由匹配时将赋值给$route.current的映射信息。 Object属性:
|
返回
[Object]自身