Reputation: 283
I am new with angularJS. and trying to concatenate two variables?
ng-init = "imgid={{$parent.$index+$index}}"
also tried=>
setImgCounter(post.postImages.length,$parent.$index+$index)
here $index=3 and $oarent.$index=3
. I want something like 33 but it is showing me 6 . setImgCounter
is a function and I want to send $parent.$index+$index
as a variable.is there any way to achieve 33 instate of 6.
Upvotes: 0
Views: 1481
Reputation: 222
Try this
ng-init = "imgid={{$parent.$index+' '+$index}}"
Upvotes: 1
Reputation: 2839
You need to convert your integers to string to concatenate, then the resulting string back to integer for later process (I imagine):
parseInt($parent.$index+""+$index)
Upvotes: 2
Reputation: 1195
Try doing something like
ng-init = "imgid={{$parent.$index}}{{$index}}"
Upvotes: 1