来源:http://docs.angularjs.org/api/ngRoute.$routeProviderhtml
有省略。angularjs
$routeProviderapi
ngRoute模块中的服务promise
描述ide
用于配置路由函数
示例spa
配置与ngRoute的使用参见$routecode
依赖htm
须要安装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]自身