I am working in app and i get this complicated situation with select and the select value. I have a json answer "portions" if it is necessary i can re-arrange my json to solve my problem.
"products": [
{...},
{...},
{
// Here the json
"id": 13,
"hightlighted": true,
// Here the portions that i loop in the "select"
"portions": [
{
"size": "De 10 a 20 porciones",
"price": "20"
},
{
"size": "De 20 a 30 porciones",
"price": "30"
},
{
"size": "De 30 a 40 porciones",
"price": "40"
}
]
}
]
<div class="item" ng-repeat="product in products">
// Here is my try one
<select class="form-control" ng-init="size=product.portions[0].size" ng-model="size" >
<option ng-repeat="p in product.portions" value="[[p.size]]" >
[[p.size]]
</option>
</select>
<div>
[[I need here the selected PRICE]] <br>
[[size]] <br>
</div>
// My try 2
<select class="form-control" ng-init="price=product.portions[0].price" ng-model="price" >
<option ng-repeat="p in product.portions" value="[[p.price]]" >
[[p.size]]
</option>
</select>
<div>
[[price]] <br>
[[I need here the selected SIZE]]
</div>
</div>
Thank you for any help.
edit. I am using [[]] instead of {{}}
.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
});
Here the solution !!! thanks solution