Create calculator application use Angularjs
Part 4:
ng-option is one of the angularjs module. ng-option is using to create calculator application. This module is embedded in <select> html tag.
Syntax:
<select
ngModel = "{select ng-model name - string}"
[name ="{select name - string}"]
[required]
[ngRequired="{string format}"]
[ngOptions = "{comprehension_expression}"]>
</select>
The angularjs module, ngOptions can be used dynamically create option list in <select> tag. The ngOptions
is consist of array values.
example:
<select
ng-model = "selectedOperator"
ng-options = "operator for operator in operators" >
</select>
operators is an array, create in controller site,
example:
$scope.operators = [ '+' , '-', '*', '/' ];
sample code:
Demo :
Calculator - jsfiddle
Touch with me! Gain more!
No comments:
Post a Comment