I am working on a angularjs form. I want to pass definition.clazz to a js function. In the controller, i have a js function like :
$scope.createData=function(clazz){
// do stuff
}
Here is the snippet of form :
<select class="form-control" id="type" name="type" ng-model="definition.clazz">
<option value="PrimitiveType"
ng-selected="type.type=='PRIMITIVE'">
PrimitiveType
</option>
<option value="EnumerationType"
ng-selected="type.type=='ENUM'">
EnumerationType
</option>
</select>
<button type="button"
class="btn btn-primary"
ng-click="createData(definition.clazz)">
Create Data
</button>
When I click to create Data button, the ng-model
is not set. Even when I print definition.clazz
in console log.
How to get the select value of select?
Thanks.