0
有没有什么办法在点击时增加ng-repeat循环内的变量?AngularJs:简单的系统
<li class="item" ng-repeat="post in posts">
...
...
<button ng-click="postLike(post.like_count)">Like {{post.like_count}}</button>
...
...
</li>
$scope.postLike = function(likeCount) {
//likeCount++
}
我很可能使用$scope.$apply
莫名其妙,但我怎么知道到底递增哪些变量?
只是为了澄清:为什么这个工程的原因是你正在传递一个引用类型的函数,并改变它,问题是传递一个原始类型。 –