Currently, I am utilizing AngularJS to create a select dropdown field populated with options from an array. The end user has the ability to add options via an input box. While the $scope successfully adds to the array, the dropdown select box displays "undefined" for all options.
Despite my efforts to find solutions, none of them seem to address the specific error I am encountering. Additionally, most resources focus on Angular 2+ which is not helpful in my case.
<select class="form-control" id="maidOfHonor" ng-model="name"
ng-options="names.value as names.value for name in names">
</select>
$scope.names = [
{
name: "Position Not Filled",
value: "Position Not Filled"
}
];
$scope.addName = function() {
$scope.names.push({ name: this.party.addName, value: this.party.addName });
console.log($scope.names);
}
My desired outcome is for any "name" added through the $scope.addName() function to be included in the dropdown select box as either the value or the name, rather than displaying undefined.