I'm currently working on an angularjs form where I need to pass definition.clazz to a js function. In my controller, I have the following js function:
$scope.createData=function(clazz){
// do stuff
}
Below is a snippet of the 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>
However, when I click the "Create Data" button, the ng-model is not set and even printing definition.clazz in console log shows nothing. How can I retrieve the selected value from the select element? Any help would be appreciated.