0
我尝试从南希错误信息返回到基于角2Angular2和Nancy:处理错误消息
我南希服务器代码的Web应用程序:
private dynamic GetSolution(dynamic arg)
{
string solutionName = arg.name;
if (solutionName == "error")
{
var response = Json(new {message = $"error"});
response.StatusCode = HttpStatusCode.BadRequest;
return response;
}
return Json(solutionService.GetSolutionByName(solutionName));
}
在客户端与接下来的工序响应代码:
onButtonClicked(name: string): void
{
this
.solutionsService
.getSolutionByName(name)
.subscribe(
p=>this.showMessage(p.title),
p=>this.showError(p.message));
//this.refresh(true);
}
如果效应初探与状态200 - 我接收预期的对象(字段ID和标题的溶液),
我该怎么办了?