I have a small function in AngularJS that retrieves the meeting ID value from a drop-down menu when it is changed. The display value of the meeting name is used for this purpose.
The values in the drop-down menu are sourced from an array that is populated when the page loads.
Now, I need to retrieve two additional values from the same array to be used later in the code.
I attempted to add the variable assignment in a similar manner to how I did it for the meeting ID, but unfortunately, the values are not being assigned as expected.
Here is the snippet of code:
$scope.GetValue = function (meeting) {
$scope.meetingId = $scope.selectedMeeting;
$scope.meetingName = $.grep($scope.MeetingList, function (meeting) {
// These are the 2 new variables
meeting.MeetingDate == $scope.meetingDate;
meeting.MeetingTitle == $scope.meetingTitle;
return meeting.MeetingID == $scope.meetingId;
})[0].MeetingName;
console.log("Selected MeetingID: " + $scope.meetingId + "\nSelected Meeting Date - Title: " + $scope.meetingName + "\nSelected Meeting Title: " + $scope.meetingTitle + "\nSelected Meeting Date: " + $scope.meetingDate);
};
};
I've also included the HTML portion to demonstrate how the values are obtained and displayed in the drop-down:
<label for="meeting-list">Current Available Meetings</label>
<select ng-model="selectedMeeting" ng-change="GetValue()" ng-disabled="form.$invalid || !email" >
<option ng-repeat="meeting in MeetingList" value="{{meeting.MeetingID}}">Meeting: {{meeting.MeetingName}}</option>
<option value="">--Select Meeting--</option>
</select>
If anyone could provide assistance on correctly implementing this update, it would be greatly appreciated.
Thank you, Erasmo.