I'm learing Angular JS and I'm currently in the process of understanding what it does and what it does not.
I'm trying to do a simple calculator that has two numbers and an operator as input.
I'm having a hard time to understand how to evaluate the operator on the binding. This is my code:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div id='example' ng-app=''>
<input ng-model='number1' type='number'>
<select ng-model='operation' ng-options="op for op in ['+', '-', '/', '*']"></select>
<input ng-model='number2' type='number'>
<div id='output' ng-bind="number1 + number2"></div>
</div>
Instead of number1 + number2
I want it to be something like eval(number1 operator number2)
but don't know how to do it.