简体   繁体   English

Angular 7 location.back 无需重新加载页面

[英]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.

相关问题 Angular2 location.back()页面重新加载? - Angular2 location.back() page reloads? 如何在location.back(不是SPA)之后重新加载上一页中的当前页面 - How to reload current page in previous page after location.back (not SPA) Angular 5-我应该使用哪个向后导航-href或location.back()? - Angular 5 - Which should I use to navigate backward - href or location.back()? 如何停止在ionic 3 angular 4中重新加载页面 - how to stop reloading of a page on go back in ionic 3 angular 4 在不重新加载页面的情况下覆盖location.search javascript - Override location.search javascript without reloading page 如何在不重新加载 angular 组件的情况下从另一个组件返回到一个组件? - How to come back to a component from another without reloading the component in angular? 使用JS Window.Location重写URL而不重新加载页面? - Rewrite URL using JS Window.Location without reloading the page? 更改window.location.hash而不重新加载页面/网站 - change window.location.hash without reloading page / website 在不重新加载页面的情况下从 Javascript → Python 发送数据并返回 - Send data from Javascript → Python and back without reloading the page 在不重新加载整个页面的情况下重新执行js - Re-execute js on back without reloading the whole page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM