如果表单较脏则阻止路由[Angular 2] [英] Block routing if form is dirty [ Angular 2 ]

查看:42
本文介绍了如果表单较脏则阻止路由[Angular 2]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此感到受阻,
在Angular 2中,如果页面中的表单为 dirty

I am blocked with this,
In Angular 2, I need to block any user click event, even browser refresh if the form in the page is dirty

您能帮我提出想法吗?

推荐答案

似乎您正在寻找它使您可以阻止路由.您将需要一个共享服务,在其中更新表单脏状态,以便保护人员可以访问它.

It allows you to block routing away. You would need a shared service where you update the forms dirty state so that the guard can access it.

这篇关于如果表单较脏则阻止路由[Angular 2]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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