Hi, The issue occurs because ng-model is shared across ng-repeat items. You will have to uniquely identify ng-model for each `icms`. For eg. in the edited fiddle below, I have created `selected` object as a property of `icms`. Alternatively `selected` could have been an array of objects, with each item in this array corresponding to the item in ng-repeat.
http://jsfiddle.net/6nu33sz4/ I hope this helps. Regards, Vaibhav Gupta On Thursday, 5 May 2016 19:56:45 UTC+5:30, Gih wrote: > > I am a beginner with AngularJS, and am having trouble with the ng-repeat: > > The user can enter a snippet of a form as many times as you want but each > should be possible to select different options. > > I put the ng-reapet but happens qua the option to select any of the > replicated parts, automatically switches the other equal selects the other > parts also > > > http://jsfiddle.net/yfj68juq/ > > <div ng-app="icmssProdutos" ng-controller="IcmssProdutosController"> > <div ng-repeat="icms in ICMSs"> > <div class="jumbotron"> > <label for="ex2">Regime</label> > <select class="form-control" ng-model="selected.regime" > ng-options="r.regime for r in data"> > <option value="">Selecione o Regime</option> > </select> > <label for="ex2" ng-show="selected.regime">Situação Tributária > <select class="form-control" ng-show="selected.regime" > ng-model="selected.situacao" ng-options="s.situacao for s in > selected.regime.SituacaoTributaria"> > <option value="">Selecione a Situação Tributária</option> > </select> > </label> > <label for="ex2" ng-show="selected.regime">Origem > <select class="form-control" ng-model="selected.Origem" > ng-options="o.Origem for o in selected.regime.Origens"> > <option value="">Selecione a Origem do Produto</option> > </select> > </label> > </div> > </div> > > > <button type="button" class="btn btn-warning" > ng-click="IncluirICMS()">INCLUIR</button></div> > > How to solve this? > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
