In my angularJS I'm using ng-repeat
to iterate through comments like so.
<li class="item block-size" ng-repeat="comment in comments" >
<div class="header">
<span class="count">{{$index + 1}}</span>
<span class="people">3 <i class="icon-user icon-large"></i></span>
<span class="comments">5 <i class="icon-comments-alt icon-large"></i></span>
<span class="open"><a href="#conversation-modal" role="button" ng-click="commentPopup({{comment.comment_id}})" ><i class="icon-external-link icon-large"></i>Onions</a></span>
</div>
<li>
In ng-click
, I am calling a function the controller called commentPopup
, which is suppose to take the currents comment id. The problem is it does not work with expressions. The function looks like this:
$scope.commentPopup = function(comment_id) {
alert(comment_id);
};
If I do
commentPopup(1);
it works. But if I do
commentPopup({{comment.comment_id}})
I does not work. Can anyone else me how to pass the comment id into this function?