Simple question: How can I set a scope value in html, to be read by my controller?
JSFiddle: http://jsfiddle.net/ncapito/YdQcX/
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.