The problem is that the child directive is bound to the parent, however the syntax {{name}} ignored by ng-repeat . What would be the right way to achieve this?
HTML (main / child directive)
<compact-select no-item-selected-text="Add a Customer" no-item-selected-icon="fa-user" search-placeholder="Type a customer name" cs-model="customer" cs-items="contacts" > <display-item-template> <span>{{name}}</span> or <span>{{item.name}}</span> </display-item-template> </compact-select>
Directive
angular.module('core').directive('compactSelect', [function($timeout) { return { templateUrl : 'modules/core/views/components/compact-select-tpl.html', bindToController: true, transclude: true, scope: { noItemSelectedText: '@', noItemSelectedIcon: '@', csModel: '=', csItems: '=csItems' }, controllerAs : 'ctrl', controller : function($scope) { } }; }]).directive('displayItemTemplate', function($timeout) { return { require: '^compactSelect', restrict: 'E' } });
Directive template (modules / kernel / views / components / compact-select-tpl.html)
<div class="compact-select-repeater-box" style="" > <div ng-transclude ng-repeat="item in ctrl.csItems | filter:searchParam" class="compact-select-repeater" ng-class="ctrl.getHighlightedClass(item)" ng-click="ctrl.itemSelected(item)"> <span>{{item.name}}</span> <span>{{item.id}}</span> </div> <div style="position:absolute;bottom:0"> <a href="#">+ Click here to add customer {{ctrl.message}}</a> </div> </div>
I see what
<span>{{item.name}}</span> <span>{{item.id}}</span>
Gets a replacement for
<span></span> or <span>{{item.name}}</span>
, but not
<span>{{name}}</span> or <span>{{item.name}}</span>
Question: How do I get ng-repeat to respect the syntax of html bindings to the child directive? Or is there another way to achieve this?