Hi I am using angularjs to build a form I have a array return from php like this and I want to build a form like this from the array.
<b>Company</b>
<select ng-model="attributs[]">
<option>Chinese</option>
<option>Japanese</option>
</select>
<b>Color</b>
<select ng-model="attributs[]">
<option>Black</option>
<option>Red</option>
</select>
[
{
id: 1,
name: "Company",
attribute_values:[
{
id: 1,
name: "Chinese"
},
{
id: 2,
name: "Japanese"
}
]
},
{
id: 2,
name: "Color",
attribute_values:[
{
id: 4,
name: "Black"
},
{
id: 5,
name: "Red"
}
]
}
]
I want all the selected value from the select option I tried this but not working. Thank you in advance.
<div ng-repeat="attrib in attributes.data">
<label class="col-sm-5 col-form-label"><% attrib.name %></label>
<div class="col-sm-5">
<select ng-model="attrib.attributeSelected" ng-options="atb.value as atb.name for atb in attrib.attribute_values">
</select>
</div>
</div>