【发布时间】:2017-04-13 14:04:53
【问题描述】:
页面中的路由没有发生。我使用了下面的 HTML 和配置代码。
<nav aria-label="Page navigation">
<ul class="pagination pagination-plain">
<li>
<a href="review/words" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li [routerLinkActive]="['active']">
<a [routerLink]="review/words">1</a>
</li>
<li [routerLinkActive]="['active']">
<a [routerLink]="review/phrase">2</a>
</li>
<li>
<a href="javascript:void(0)" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
路由配置代码是
const appRoutes: Routes = [
{
path: '',
component: IndexComponent,
},
{
path: 'index',
component: IndexComponent,
},
{
path: 'review/words',
component: WordsComponent,
},
{
path: 'review/phrase',
component: SentenceComponent,
}
];
当我点击分页链接中的“1”或“2”时出现以下错误。
ERROR 错误:未捕获(在承诺中):错误:无法匹配任何路由。 URL 段:'review/phrase/NaN' 错误:无法匹配任何路由。网址 段:'review/phrase/NaN' 在 ApplyRedirects.noMatchError (router.es5.js:1404) [角度] 在 CatchSubscriber.selector (router.es5.js:1379) [角度] 在 CatchSubscriber.error (catch.js:104) [角度] 在 MapSubscriber.Subscriber._error (Subscriber.js:128) [角度] 在 MapSubscriber.Subscriber.error (Subscriber.js:102) [角度] 在 MapSubscriber.Subscriber._error (Subscriber.js:128) [角度] 在 MapSubscriber.Subscriber.error (Subscriber.js:102) [角度] 在 MapSubscriber.Subscriber._error (Subscriber.js:128) [角度] 在 MapSubscriber.Subscriber.error (Subscriber.js:102) [角度]
【问题讨论】:
标签: angular routerlink routerlinkactive