How to insert value in option - AngularJS

I’m not able to get the correct tag “value” of each option

In the DOM, options, displaying this value = "object: 3" value = "object: 4" etc.

"SituacaoTributaria": [{
    		"value": 00,
    		"situacao": "00 - Tributada Integralmente"

        }, {
    		"value": 10,
    		"situacao": "10 - Tributada com Cobrança de ICMS por ST"


We report the value and select each array, but does not print on values in each option

ng-repeat has a truly horrible API, I need to look it up each time I use it.

I think you need to add a “track by” to specific the value.

ng-options="r.regime for r in data track by r.value"


this returning value="undefined"

I don’t see that in jsfiddle

<select class="ng-pristine ng-valid ng-empty ng-touched" ng-options="r.regime for r in data track by" ng-model="selected.regime">
  <option class="" value="" selected="selected">Selecione o Regime</option>
  <option label="Tributação Normal" value="0">Tributação Normal</option>
  <option label="Simples Nacional" value="1">Simples Nacional</option>
1 Like

Thanks it helped me a lot.

I have one more question with the same code, if you think I should open another question please let me know

How do I display the next select only when you select an option in the first select?

You can add ng-show="selected.regime" on the next <select> to do that.

1 Like

This worked perfectly well

I need to add the form by clicking :flushed::blush:
The user can enter several times the same form and each form select different options.

I tried to use ng-click but not working.

`<button type="button" class="btn btn-warning" ng-click="IncluirICMS">INCLUIR</button>`

$scope.IncluirICMS = function(){
	  ${regime: $scope.regime, SituacaoTributaria: $scope.SituacaoTributaria, Origens: $scope.Origens});

I believe it should have a more practical way to replicate an entire form with every click

Needs parens


Please see

I select a value in a form and other form changes as well. Necessary that each form can select different options

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.