DEV Community

Discussion on: How to create a calculator application with Ionic framework 3 by using Ionic Creator for UI

Collapse
 
nikola profile image
Nikola Brežnjak

It's actually quite easy (just wrap it in try/catch block) and I already covered it in the post #3 that should be done by the end of the week (I'll update you once it's done). But, until then, here the example code you can use:

try {
    this.result = eval(this.result).toFixed(2);
} catch () {
    // this.showAlert(); //show some error message
}
Collapse
 
imranyouthink profile image
Lucien Zera

Thank you very much!

Thread Thread
 
nikola profile image
Nikola Brežnjak • Edited

Hey Lucien,

You're welcome! The new post in the series should be out tomorrow, where you'll see this implemented 💪