I want to do this...
<span ng-repeat="item in array1" ng-include="'genericItemTemplate.html'">
and this...
<span ng-repeat="item in array2" ng-include="'genericItemTemplate.html'">
and then in the genericItemTemplate.. do this...
[{{$index + 1}} of {{someArrayreference.length}}]
can I reference the array of the ng-repeat within the template?
see also my longer post... https://groups.google.com/forum/?fromgroups=#!topic/angular/y_KuX0HRQ_U
and my plunkr
http://plnkr.co/edit/dY7M76kPyLeK0fvVZhvB
Michael
Use onload, an ng-include optional parameter:
<li ng-repeat="person in personlist=friends" ng-include="'myGenericTemplate.html'"
onload="len=friends.length"></li>
<li ng-repeat="person in personlist=collegues" ng-include="'myGenericTemplate.html'"
onload="len=collegues.length"></li>
[{{$index + 1}} of {{len}}] {{person.name}}
Output:
I have friends. They are:
[1 of 2] John a boy who is 25 years old.
[2 of 2] Mary a girl
I also have collegues. They are:
[1 of 3] Hoolio a boy who is 42 years old.
[2 of 3] Kitty a girl
[3 of 3] Marge a girl