现在从头开始开发基本应用程序时遇到了一个奇怪的错误. 我使用的是Ionic 4 beta 19,并且已将routerLink放置到另一个页面,该路由是在基本页面模块中设置的,如下所示:
RouterModule.forChild([ { path: '', component: NewsPage }, { path: ':id', component: DetailPage } ])routerLink属性是在卡上设置的,单击卡时它可以正常工作,但是当我返回并按下同一张卡或另一张卡时,路由器根本不执行任何操作.我没有任何错误,浏览器中的URL正常运行.怎么会这样?
而且,DetailPage没有模块,因此它基本上只是一个页面.
卡代码如下:
<ion-card *ngFor="let item of items;" [routerLink]="[item.id]"> ... </ion-card>在详细信息页面中,订阅了路由参数,并且:id参数将用于GET请求订阅以检索数据
解决方案此问题已解决,只需运行npm i @ionic/angular即可更新到4.2.0或更高版本.
这也影响了router.navigate(['url', params])功能
I'm having a weird bug while developing a basic app from scratch right now. I use Ionic 4 beta 19 and I've put a routerLink to another page, the route is set up in the base pages module like so:
RouterModule.forChild([ { path: '', component: NewsPage }, { path: ':id', component: DetailPage } ])the routerLink attribute is set on a card and it works just fine when clicking on a card, but when I go back and press that same card or another one, the router just doesn't do anything at all. I don't get any errors and the URL in the browser is working perfectly. How can this be?
Edit: Also, DetailPage doesn't have a module so it's basically just a page.
Edit: Card code looks like this:
<ion-card *ngFor="let item of items;" [routerLink]="[item.id]"> ... </ion-card>In the detail page, route params are subscribed and the :id param will be used for a GET request subscription to retrieve the data
解决方案This is already fixed, just run npm i @ionic/angular to update to the fixing version 4.2.0 or superior.
This was also affecting router.navigate(['url', params]) functionality
更多推荐
离子4 +角度:routerLink仅在第一次使用
发布评论