Currently, I have an angular.js <select> filled by the following query:
c.ip for c in cameras track by c.idCamera
and it produces on my <select> something like:
<option value="1">192.168.0.121</option>
<option value="2">192.168.0.122</option>
<option value="3">192.168.0.123</option>
...
my $scope has a list of cameras and I can see the IP, but I want to use two fields as label -- let's say camera's IP and type.
I'm looking way to produce as output something like this:
<option value="1">192.168.0.121 - ZOOM</option>
<option value="2">192.168.0.122 - PAN </option>
<option value="3">192.168.0.123 - ZOOM</option>
...
I'm currently using angular.js beta 6, if that has any additional bearing on the matter.
The label in the ngOptions directive is an expression like all the others. It can be as complex as you want:
<select ng-model="myCamera" ng-options="(c.ip + ' - ' + c.type) for c in cameras track by c.idCamera"></select>
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