I am building a little shopping cart. I have different products that each have different options. The options select should only show the options for the selected product.
My JS looks like that:
$scope.products = [{
name: 'Normal Product',
cost: 25,
options: ["Option #1", "Option #2"]
},
{
name: 'Cool Product',
cost: 100,
options: ["Option #1", "Option #2"]
}, {
name: 'Sick Produckt',
cost: 150,
options: ["Option #1", "Option #2"]
}];
And HTML:
<td>
<select ng-model="item.product" ng-options="p.name for p in products">
</select>
</td>
<td <select ng-model="item.option" ng-options="o for o in item.product.options">
</select>
</td>
JSFiddle: http://jsfiddle.net/NyvbN/2/
The only problem was that you did not close the td tag: You have <td without closing >
<td> <select ng-model="item.option" ng-options="o for o in item.product.options">
Your fiddle works fine otherwise.
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