[英]Angular 7 location.back without reloading the page
I am using angular 7, and I have a list of items when I click on one item it's go to edit the item page,I put a back button in edit item page, when I click back it's reload the items page and go to the top of the page, How can I go back without reload the page or return back to the last position in the list.我正在使用 angular 7,当我点击一个项目时,我有一个项目列表,它是 go 来编辑项目页面,我在编辑项目页面中放了一个后退按钮,当我点击返回时,它会重新加载项目页面,go 到页面顶部,如何在不重新加载页面或返回列表中最后一个 position 的情况下返回 go。
that's what was trying:那就是在尝试:
<button type="button" (click)="onBack()" style="width:49%" class="btn btn-secondary btn-lg">cancel</button>
onBack() {
console.log("on back...");
this.location.back();
return false
}
Try this.router.navigate(['---Name of your route---']);
试试this.router.navigate(['---Name of your route---']);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.