【发布时间】:2019-04-18 14:05:42
【问题描述】:
Angular 6 中的路由
当我路由到特定位置时,我会使用
route.navigate(['/home'], { skipLocationChange: true });
但是当返回之前的路线时,下面的代码没有帮助, 有没有其他方法或应该删除“{ skipLocationChange: true }”
import {Component} from '@angular/core';
import {Location} from '@angular/common';
@Component({
// component's declarations here
})
class SomeComponent {
constructor(private _location: Location)
{}
backClicked() {
this._location.back();
}
}
【问题讨论】:
-
你有没有发现如何隐藏 url 同时又能回到 Angular 中?我也需要。 :)
-
否 @YaroslavTrofimov 我写了一个服务来保存我的 url 历史记录并基于 Forward 和 Backward 进行推送和弹出
标签: javascript html angular routing angular6