1

How do I display error message in my application as oppose to printing in the console. This is an example below (printing in console)

promise.catch(e => console.log(e.message));

I want to be able to print the above in my html.

Any help?

8
  • assigning value to variable not working? Commented Oct 15, 2016 at 18:47
  • I have tried that so many times and it is not just working. Any other idea you think? Commented Oct 15, 2016 at 18:51
  • Please show what have you tried so far? Commented Oct 15, 2016 at 18:55
  • @SydneyLoteria why did you delete it? Commented Oct 15, 2016 at 18:59
  • Here is what i tried: promise.catch(function(error){ this.one = error.message; }); Commented Oct 15, 2016 at 18:59

1 Answer 1

1

You can use AarrowFunction ()=> as shown,

promise.catch((error)=>{ this.one = error.message; });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.