md-item-template for md-autocomplete cannot access parent scope
This seems to be an issue that was introduced at some point in 0.11, as my upgrade to 0.11 from 0.10.1 seems to break things.
In short, I have a directive that essentially wraps md-autocomplete, and provides some app-specific logic that helps with the display of autocomplete items. It is still intended to be just as generic as md-autocomplete, but part of wrapping md-autocomplete means I would prefer to be able to abstract some of the templating logic for each item.
I've added a codepen below to give some insight into this problem, but essentially what I'm doing is:
<div class="extended-autocomplete-directive">
<md-autocomplete md-items="item in ...">
<md-item-template>
<div class='template-text' >{{item[someDisplayAttributeAttachedToDirectiveScope]}}</div>
</md-item-template>
</md-autocomplete>
<div class="some-other-stuff">...</div>
</div>
This worked in 10.1, and allowed me to attach an arbitrary attribute to the scope of my directive that I could use in my md-item-template to help display the information I wanted. This seems to no longer work in 11.0.
I've also tried using ng-transclude to pull in the md-item-template from further up. The markup would look like:
<extended-md-autocomplete>
<md-item-template>
...
</md-item-template>
</extended-md-autocomplete>
With my directive template looking something like:
<div class="extended-md-autocomplete">
<md-autocomplete ng-transclude></md-transclude>
</div>
This throws a transclusion error (duh), as md-autocomplete does not transclude.
I'm thinking this is a bug, but maybe its intended behavior. If so, advice on how to proceed would be much appreciated.
Code pen: http://codepen.io/Flare/pen/KdpoeZ?editors=101
This looks like a more generic version of bug #4390. I will investigate.
@4storia Would you be able to test PR #4391 to see if it resolves your issue?
Yes, this fixes my issue. Good stuff :D
@4storia Awesome, thanks for the feedback!