问题描述
在实际的Angular2 beta 14(及之前的版本)中,Safari(实际上使用9.1)上的后退"按钮(使用路由和多个视图时)似乎存在问题: .com/angular/angular/issues/7722"rel =" noreferrer> https://github.com/angular/angular/issues/7722
In the actual Angular2 beta 14 (and before) there seems to be an issue with the back button (when using routing, and several views) on Safari (actually using 9.1): https://github.com/angular/angular/issues/7722
我也遇到了这个问题,尽管它可以正常工作,例如在Chrome上.
I also experienced this problem, while this works fine e.g. on Chrome.
我正在寻找解决方法,直到问题解决?
I'm looking for a workaround until the issue is fixed?
推荐答案
在"angular2"上:"2.0.0-beta.14"
On "angular2": "2.0.0-beta.14"
我必须在区域内运行刻度线才能使其对我有用.
I had to run the tick inside a zone to get it to work for me.
import {ApplicationRef, <anything else you need>} from 'angular2/core';
import {Router,<anything else you need>} from 'angular2/router';
export class AppComponent {
constructor(private _ref: ApplicationRef, private _router: Router) {
_router.subscribe((value) => {
_ref.zone.run(() => _ref.tick());
});
}
}
这篇关于Angular2 Safari后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!