This is my html code
<select ng-model="node.field.name"
data-nodrag
ng-options="value.label as value.label group by value.name for value in myOptions"
ng-change="getConditionsByType(node.field.name,value.name)">
</select>
When is use getConditionsByType(node.field.name,value.name)
i am getting value.name as undefined
how can i access the values from ng-repeat when changing the options!
value
is not defined in the scope of ng-change
- it is only defined in the microsyntax expression of ng-options
.
Instead, make the model to be the "value" - i.e. the item of myObjects
.
<select ng-model="selectedOption"
ng-options="value as value.label group by value.name for value in myOptions"
ng-change="onChange()">
</select>
This means that you can't set node.field.name
to "value.name" directly - do so, in ngChange
instead:
$scope.onChange = function(){
$scope.node.field.name = selectedOption.name;
getConditionsByType($scope.node.field.name, selectedOption.name)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With