您好,登录后才能下订单哦!
密码登录
            
            
            
            
        登录注册
            
            
            
        点击 登录注册 即表示同意《亿速云用户服务条款》
        今天遇到个难题就是ng-click传参问题,在网上找了好多资料,先留个笔记
<ul id="dataSet" ng-repeat="item in infos" ng-model="dataSet">
  <li ng-click="sentOutQuery('{{item.detailId}}')" >
    <div class="voucherLeft">
      <p class="p1">{{item.transAmount}}</p>
      <p class="p2">已分配:<span >{{item.usePoints}}</span></p>
    </div>
    <div class="voucherRight">
      <p class="p3">授信方:<span>{{item.rollOutAccountName}}</span></p>
      <p class="p4">授信日期:<span>{{item.createTime}}</span></p>
    </div>
  </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代码中获取该参数

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持亿速云。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。