Issue
I´m using filters in Angular JS, however, the list that is displayed in the filter shows the value like this:
[{"text":"IVA"}{"text":"IVAT0"}]
This is the <DIV> where I´m doing the filter:
<div class="form-group col-md-6">
<label>
IMPUESTOS
</label>
<select ng-model="articulo.impuestos_compra" name="impuestos_compra" class="form-control input-lg" required>
<option value="@{{ impuestos_compra }}">@{{ impuestos_compra }}</option>
</select>
</div>
And, this is my try to iterate this array:
$scope.impuestos_venta = @json($impuestos_venta);
impuestos_compra = ['IVA' , 'IVAT0' ];
impuestos_compra.forEach(function(impuestos_compra) {
console.log(impuestos_compra);
});
I want the filter to show both options separately, so the use can select either IVA or IVAT0.
Can you help me please? using the <option> tag is not an option, I was asked to bring the values from the database.
Thank you.
Solution
If I understand your situation right, then you need ngRepeat to iterate over your options in the HTML, and then pass the data in the option
// This is your array
impuestos_compra = ['IVA' , 'IVAT0' ];
How to use in the View now:
// iterate over the impuestos_compra and then pass it to the option
<select ng-repeat="item in impuestos_compra" class="form-control input-lg" required>
<option value="item">{{ item }}</option>
</select>
Answered By - Alok
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.