Javascript 如何在Angular JS中迭代数组
我在Angular JS中使用过滤器,但是,过滤器中显示的列表显示如下值: [{“文本”:“IVA”}{“文本”:“IVAT0”}] 这是我进行筛选的Javascript 如何在Angular JS中迭代数组,javascript,angularjs,Javascript,Angularjs,我在Angular JS中使用过滤器,但是,过滤器中显示的列表显示如下值: [{“文本”:“IVA”}{“文本”:“IVAT0”}] 这是我进行筛选的: <div class="form-group col-md-6"> <label> IMPUESTOS </label&
:
<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>
我希望过滤器分别显示这两个选项,以便用户可以选择IVA或IVAT0
你能帮我吗?使用
标记不是一个选项,我被要求从数据库中获取值
谢谢。您正在查找ng options属性如果我正确理解您的情况,那么您需要在HTML中迭代您的选项,然后在选项中传递数据
// This is your array
impuestos_compra = ['IVA' , 'IVAT0' ];
现在如何在视图中使用:
// 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>
//迭代imputestos\u compra,然后将其传递给选项
{{item}}
如何修复该问题?我是新手,哈哈哈!这就是为什么我们在这里@Rodri6uez。周末快乐!保持安全:)
// 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>