I have the following code:
<select class="form-control" data-ng-model="form.ProtocolId" data-ng-options="protocol.ProtocolId as protocol.Name for protocol in protocols" required />
Where a protocol has this structure:
[{ "ProtocolId": 1, "Name": "Protocol 1", "Description": "A description for protocol 1" }]
In $scope.form I am setting the ProtocolId, which is what I need to submit the form. But I would like to show the description of the Protocol to the user when they select it. Sort of like {{selectedProtocol.Description}}
. Except I don't have a selectedProtocol
as I'm only selecting the id.
Is there a way to get the actual selected Protocol here? I could write a method to track the change of a selected Protocol and then in my controller set the form.ProtocolId, but I wonder if there is a simpler way...