如何将父元素id作为参数传递给ng-change上的函数

时间:2015-11-30 10:10:19

标签: html angularjs angularjs-directive angularjs-ng-repeat



 <ul class="nav" id="usrList">
    <li ng-repeat="user in users" id={{user.uid}} name={{$index}} 
        ng-click="fillUserForm($event)">{{user.mobile + " / " + user.email}} 
      <input type="checkbox" style="float:right;" ng-model="usersCheck[$index]" 
           ng-change="activeInactiveUser($parent.attribute.id,usersCheck[$index])" 
           ng-checked="usersCheck[$index]" />
    </li>
</ul>
&#13;
&#13;
&#13;

如何获取父元素ID以在 activeInactiveUser(parent id,"") 函数中传递它。

2 个答案:

答案 0 :(得分:1)

您可以直接将activeInactiveUser传递给函数 <ul class="nav" id="usrList"> <li ng-repeat="user in users" id={{user.uid}} name={{$index}} ng-click="fillUserForm($event)">{{user.mobile + " / " + user.email}} <input type="checkbox" style="float:right;" ng-model="usersCheck[$index]" ng-change="activeInactiveUser(user.uid, usersCheck[$index])" ng-checked="usersCheck[$index]" /> </li> </ul>

Insert into tablename (column1, columns2)
Values (value1, ISNULL(Value2,value1))

答案 1 :(得分:1)

使用ng-init,因为它很冗长并提高了可读性:

sfInit(parallel=TRUE, cpus=4)
sfSource(code.R) #if you have your function in a separate file
sfExport(list=c("variable1","variable2",
            "functionname1")) #export your variables and function to cluster
results<-sfClusterApplyLB(parameters, functionname) #this starts the function on the clusters