0

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.

0

3 Answers 3

2

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)
Sign up to request clarification or add additional context in comments.

Comments

1

Try doing something like

ng-init = "imgid={{$parent.$index}}{{$index}}"

Comments

1

Try this

ng-init = "imgid={{$parent.$index+' '+$index}}"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.