@Injectable()
export class MyInterceptor implements HttpInterceptor
{
intercept(req : HttpRequest<any>, next : HttpHandler) : Observable<HttpEvent<any>>
{
//show a modal dialog to hold the request until user respond/close the dialog
if(ShowModalDialog())
{
return next.handle(req);
}
else
{
//route to login
}
}
}
Run Code Online (Sandbox Code Playgroud)
我试图显示一个有角度的材质对话框,但它不会阻止请求,并且会继续执行下一行。
我需要知道如何在出现请求错误响应时从拦截器显示模式对话框,向用户显示一些选项并在对话框关闭后恢复执行。
是否可以通过此类对话框停止/保留请求?
javascript typescript angular-material angular httpinterceptor