ng-init
does not work when you are assigning variables inside loop. Use
{{myVariable=whatever;""}}
The trailing ""
stops the Angular expression being evaluated to any text.
Then you can simply call {{myVariable}}
to output your variable value.
I found this very useful when iterating multiple nested arrays and I wanted to keep my current iteration info in one variable instead of querying it multiple times.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…