來源: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]自身