Basic calculator, no eval()

View Online: https://romugarcalculatorv2.herokuapp.com/
Source code: https://github.com/Romugar/Angular-Basic-Calculator-Mobile-clone.

After a long time I have managed to make a calculator with a style that pleases me and without eval (), it’s a clone of a mobile calculator, made with angular. The code has been figured by myself, without using any guide, so I’m sure there will be hundreds of better approaches, feedback are welcome!! :grinning:

I can get multiple decimal points on a number by hitting the backspace or equals key and then hitting the decimal key.

That’s all I could break just clicking around.

Nice design.

Thanks! I’m going to fix it.

I like the design as well. It doesn’t reset when it gives you an answer, for example: I clicked 4+4, it gives me 8, then I hit 3 and the 8 is still there, so my new calc will not be 3 - and whatever after- it’ll be 83 in lieu.

@br3ntor
Now you can’t put multiple decimal points by hitting backspace or equal
@sirstookie2k6
Now the result reset if you clic a number, but if you click a symbol you can keep going calculating with the result

Thanks to both for the testing!!! I really apreciate it :grinning:

Also I fix some things:

  • If result is NaN or Infinity is reset to 0
  • If result has a dot in the last position it’s deleted, also if it’s an operator.