In my project, I have a list of objects containing two attributes: label and description. As part of the HTML code, I am iterating through this list using the following code:
<select class="form-control"
ng-options="fid.label for fid in myFidList"
ng-model="fidSelected"
ng-change="setFidDescription()"/>
The goal is to call a function (setFidDescription) to retrieve the object that has been selected in the option tag. This way, I can update the respective description in another division. However, it seems like the ng-model is not updating as expected. Here is the function in question:
$scope.setFidDescription = function () {
console.log($scope.fidSelected);
}
When running this code, an empty object is printed to the console. What could be causing this issue? Alternatively, I also considered getting the $index of my selection.
For more information, refer to the following links: JSON + console
Update: I have identified the problem I was facing. Please see the following explanation for further details:
AngularJS ngModel doesn't work inside a ui-bootstrap tabset
This resolved the issue I was encountering.