You are going to have to hand back something like true or some other vapid placebo value from PUT and DELETE endpoints when using this Angular 2 means for AJAX and you cannot just have an endpoint that returns void. The only way I can see to get around this, should you not control the API you are consuming, is to wrap the Http implementation in a try/catch where the exception is swallowed so that when it blows up you do not see red at the console. Your endpoint (returning void) will still get hit.
try{
this.myHttpInstance.put(myUrl, {}, myOptions).toPromise();
}
catch(exception){
}
No comments:
Post a Comment