mardi 22 mars 2016

How to dynamically click a checkbox using angular directive controller

Here is my html

  <li 
    ng-repeat="myElement in myList">

    <input 
      type="checkbox" value="myElement"
      ng-model="checkState"
      ng-click="myDirective.updateSelectedElement(myElement, checkState)"/>
    <div>
      {{myElement.name}}
    </div>
  </li>

I have a $broadcast event such that

        $scope.$on('myEvent', function(event, data){
            // Change the checkbox state for the checkbox that have the same name in data
        }) 

The question is since my checkbox are all isolated scopes, I don't have access to it, is there a way to access the checkbox that have specific myElement.name

Thanks




Aucun commentaire:

Enregistrer un commentaire