I want to show the count of items repeated in my ng-repeat but how to I access this from outside the ng-repeat?
Plunker: http://plnkr.co/edit/SYqb8h9k81SlVY3Yzhgx
HTML:
<h3>Number of locations is: {{location.length}}</h3>
<div ng-controller="locationAccordionCtrl">
<div ng-repeat="location in locations" on-finish-render>
{{location.siteName}}
<ul>
<li ng-repeat="listOfLocations in location.locationsList track by $index">
{{listOfLocations}}
</li>
</ul>
</div>
</div>
JS:
var App = angular.module('App', []);
App.controller('locationAccordionCtrl', function ($scope) {
$scope.locations = [
{
"siteName":"First Location",
"locationsList":['First Location 1', 'First Location 2', 'First Location 3']
},
{
"siteName":"Second Location",
"locationsList":['Second Location 1', 'Second Location 2', 'Second Location 3']
},
{
"siteName":"Third Location",
"locationsList":['Third Location 1', 'Third Location 2', 'Third Location 3']
}
];
});