jeudi 5 novembre 2015

Dynamic ng-init - Angularjs

I got this:

<ul id="filterList">
      <div ng-repeat="data in dataForTheTree">
         <li> {{data.topic}} </li>
          <ul id={{data.topic}}Son>
              <li ng-repeat="d in data.children>  
                 <input type="checkbox" ng-init='{{d.subtopic}}Checkbox = true' ng-checked = "{{d.subtopic}}Checkbox"/>{{d.subtopic}}
              </li>
          </ul>
      </div>
</ul>

I need to create a "model" to know if the checkbox is checked or not (i can not use ng-model because is a bad practice). So, I am trying with ng-checked, I have read something in a similar post, but i can not understand because I am so new in this world.

"You need to access dynamic properties using [] notation instead on . notation"

How can i do that in this example?




Aucun commentaire:

Enregistrer un commentaire