简体   繁体   中英

How pass a angular model as a parameter to a javascript function

How can I pass a parameter from an angular to a javascript function?

If I try to collectDataById({{model.Id}}) I get an error. My model is being updated after the page load for first time. This what I want to have but with {{model.Id}} inside the JS function is having an error.

 <tr data-ng-repeat="model in models">
     <td class="text-center table-darker">{{model.name}}</td>
     <td class="text-center">{{model.Id}}</td>
     <td><a href="" data-ng-click="collectDataById({{model.Id}})">Get Data</a></td>
 </tr>

ng-click是Angular指令,因此请省略{{}}

<a href="" data-ng-click="collectDataById(model.Id)">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM