Angular2 Safari 后退按钮 [英] Angular2 Safari Back Button

查看:35
本文介绍了Angular2 Safari 后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实际的 Angular2 beta 14(及之前)中,Safari(实际上使用 9.1)上的后退按钮(使用路由和多个视图时)似乎存在问题: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?

推荐答案

On "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 后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆