I was wondering that if i can pass an array of objects to $scope of directive and when it occurs it shows different objects in array depending on there index in the array
eg
this is my directive template
<div id="myAdvert" style ="display: block">
<a class="item item-thumbnail-left" >
<img src="{{customer.image}}">
<h2>{{customer.name}}</h2>
<p>{{customer.address}}</p>
</a>
</div>`
This is my directive
angular.module('starter.Directives', [])
.directive('browseto', [function() {
return {
restrict: 'AEC',
templateUrl: "templates/myadvert.html",
replace: true,
scope: {
customer: '=info'
}
}
}]);
and in my controller if i pass the object array doesnt seem to work what i want is if the object array is passed then whenever the directive is shown its data should be the next object in array
i will post all the requirement so that i can make some sense
What i currently have is a list of users and i want to show an ad after every 10(x) user is shown so i am using ng-repeat to loop the users and i am putting this directive inside that ng-repeat block and showing it after every 10(x) user using ngif
Now if i assign a single object to the $scope.customer in the controller of the view then the ad is same through out the view , what i want is that when the next directive shows up in the view it should contain a different ad thats why i wanted to assign an array of objects to the directive so after every 10(X) user there will be a different ad but it doesnt seem to work so how can i go ahead and achieve this
Thanks