I have have this select field:
code:
<select ng-model="productForm.productDesc.idproductDesc" ng-options="opt2.idproductDesc as opt2.description for opt2 in productDesc"/>
where productDesc
is a result JSON text from a query, where productDesc
is the table and idproductDesc
and description are two attribute of this table. I want to show another attribute of productDesc
, such as prize ( opt2.price
in this case). I want something like that:
however: opt2.name - opt2.price
, for example if opt2.name
is "Patatine fritte classiche" and opt2.price
is 1: "Patatine fritte classiche - 1" (like in the second picture). Otherwise an output field with the opt2.price
of the selected element, in this way:
how can I do it?
Solved in this way:
<select ng-model="productForm.productDesc.idproductDesc">
<option ng-selected="{{productDesc.idproductDesc == productForm.productDesc.idproductDesc}}" ng-repeat="productDesc in productDescs" value="{{productDesc.idproductDesc}}">
{{productDesc.price}} - {{productDesc.description}}
</option>
</select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.