禁止angularJS中的空白路径

时间:2016-09-16 13:24:31

标签: angularjs

我有以

形式定义的状态
  $stateProvider
  .state('school', _.extend({}, rootStateConfig, { url: '/school/:name}))

问题是每当我点击localhost/school/它就会进入上面定义的状态。我该如何禁止空名?

1 个答案:

答案 0 :(得分:1)

尝试先映射该状态。例如:

$stateProvider
.state('schoolNew', _.extend({}, rootStateConfig, { url: '/school'}))
.state('school', _.extend({}, rootStateConfig, { url: '/school/:name'}))