Can angularjs routes have optional parameter values?

前端 未结 4 1017
清酒与你
清酒与你 2020-11-28 05:37

Can I set a route with optional params (same template and controller, but some params should be ignored if they don\'t exist?

So instead of writing the following two

4条回答
  •  再見小時候
    2020-11-28 06:08

    It looks like Angular has support for this now.

    From the latest (v1.2.0) docs for $routeProvider.when(path, route):

    path can contain optional named groups with a question mark (:name?)

提交回复
热议问题