您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

AngularJS的ng-click传参的方法

2024/4/16 2:05:14发布15次查看
本篇文章主要介绍了angularjs的ng-click传参的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
今天遇到个难题就是ng-click传参问题,在网上找了好多资料,先留个笔记
<ul id="dataset" ng-repeat="item in infos" ng-model="dataset"> <li ng-click="sentoutquery('{{item.detailid}}')" > <p class="voucherleft"> <p class="p1">{{item.transamount}}</p> <p class="p2">已分配:<span >{{item.usepoints}}</span></p> </p> <p class="voucherright"> <p class="p3">授信方:<span>{{item.rolloutaccountname}}</span></p> <p class="p4">授信日期:<span>{{item.createtime}}</span></p> </p> </li> </ul>
//js代码 $scope.sentoutquery = function(sourcedetail){ var expiresdate= new date(); expiresdate.settime(expiresdate.gettime() + 2*1000); $cookiestore.put("sourcedetailid", sourcedetail,{expires : expiresdate}); console.log(sourcedetail); window.location.href='sentoutquery.html'; }
ng-click=sentoutquery('{{item.detailid}}') 这样虽然在页面上debugger能看到传的参数值,但是这样事件点击无效,如下图;
只有将点击事件中的参数直接引入才能在对应的js代码中获取该参数
以上就是angularjs的ng-click传参的方法的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product