Dynamic ID in angularjs

0

Hello, I have this following switch:

Which is generated dynamically and is composed of the following code:

<div ng-repeat="model in modelo_final">
  <div style="float:left; padding-right:100px;">
      <div class="can-toggle demo-rebrand-2">
          <input id=IDDINAMICO type="checkbox" ng-model="modeloCustom[modulo.id]">
          <label for=IDDINAMICO>
              <div class="can-toggle__switch" data-checked="Yes" data-unchecked="No"></div>
              <div class="can-toggle__label-text">
                  <p style="font-size:15px; width:100px;">{{model.nombre}}</p>
              </div>
          </label>
      </div>
  </div>

And it turns out that the input of the switch depends on a label to work, which are related to an ID and this I need to be dynamic so they can be used independently and not that one moves everyone ...

Try with id={{$index}} and for={{$index}} and still keep moving all together ... how do I solve it?

Greetings.

    
asked by Hernan Humaña 20.12.2016 в 15:07
source

1 answer

1

Have you tried using the / array object that comes from the ng-repeat? for example <input id={{model.id}}> ?

    
answered by 20.12.2016 / 15:30
source