Intreceptor刷新表格后,提交页面

问题描述:

我使用这个代码:Intreceptor刷新表格后,提交页面

https://www.illucit.com/blog/2016/03/angular2-http-authentication-interceptor/

问题是提交我的网页refreshs人知道如何解决呢?

当我删除intreceptor:

{ 
     provide: Http, 
     useFactory: (xhrBackend: XHRBackend, requestOptions: RequestOptions, router: Router) => new HttpInterceptor(xhrBackend, requestOptions, router), 
     deps: [XHRBackend, RequestOptions, Router] 
    } 

它正常工作......随着intreceptor它没有击中API只是门柱内侧intreceptor方法,做整理...

+0

很可能是由您的表单标记引起的。你可以在你使用表格的地方张贴片段吗? –

+0

这不是...因为当我删除intreceptor时,它工作正常...... – Vladimir

问题是我的提交页面刷新任何人知道如何解决它?

您需要在表单上捕获submit事件,并在其上阻止prevent,否则会重新加载页面。