I'm using a custom directive in angular js with template url the link to code is here. The Problem is ngRpeat is not working with template url if I pass ngRepeat to the element then it does not work but if I pass in the template itself it works.
Update:
Following is the code you've written in main.html
<search-results customers-d ="customers" ng-repeat="CM in customersD></search-results>
Following is the directive searchResults you've written:
myApp.directive('searchResults', function () {
return {
templateUrl: 'directives/search.html',
scope: {
customersD: '=',
}
}
});
Following is the main controller you've written:
myApp.controller('mainController', ['$scope', '$log', function($scope, $log) {
$scope.customers = [{ name:'Rishabh'},{name:'Krishna'}]
}]);
And search.html is as follows:
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading"> hi </h4>
<p class="list-group-item-text">{{CM.name}}</p>
</a>
Now things you are doing wrong:
I think your understanding of scopes is not correct. It would be good if you read enough before asking questions here. :)
Previous Answer: You are missing closing quote in ng-repeat and using wrong variables Do as follows :
<search-results customers-d ="CM" ng-repeat="CM in customers"></search-results>