我有从付款页面返回的angular2+页面与表单数据标题中的状态信息如何我可以在angular2中检索此信息
在asp.net中,通过Request.form“键”很容易获得,在angular/Jquery应用程序中如何实现相同功能
下面是正在进行的信息
发布于 2018-06-03 12:35:57
这可以使用HttpInterceptor来完成(如果您需要修改和记录请求)
@Injectable()
export class MyHttpInterceptor implements HttpInterceptor {
constructor() {}
intercept(req: HttpRequest < any > , next: HttpHandler): Observable < HttpEvent < any >> {
console.log("intercepted request ... ");
// Clone the request to add the new header.
const authReq = req.clone({
headers: req.headers.set("headerName", "headerValue")
});
console.log("Sending request with new header now ...");
//send the newly created request
return next.handle(authReq)
.catch((error, caught) => {
//intercept the respons error and displace it to the console
console.log("Error Occurred");
console.log(error);
//return the error to the method that called it
return Observable.throw(error);
}) as any;
}
}发布于 2018-06-03 14:32:21
虽然angular (客户端javascript)浏览器不会让javascript获得post表单数据,但您可以使用node.js(服务器端javascript)或Asp.Net来接收这些数据并重定向到angular页面
<代码>H19接收付款信息并执行某些操作<代码>H210<代码>G211

https://stackoverflow.com/questions/50663222
复制相似问题