When trying to connect a custom directive to items in an ng-repeat
list generated with md-list
/md-list-item
s, I encountered a challenge due to the way angular material organizes the md-list-item
element when it's rendered in the DOM. This includes nesting an absolutely positioned button inside for ng-click
functionality, making it difficult to directly attach the directive attribute as I would with a regular md-button
or similar element.
The directive works well on other elements but attempting to add it directly to the md-list-item
proved to be unsuccessful.
You can see this issue demonstrated in JSFiddle: http://jsfiddle.net/2f6qscrp/513/.
Here is the HTML snippet:
<md-list-item view-employee employee="employee" ng-click="viewEmployee($index)" ng-repeat="employee in main.employees">