material icon indicating copy to clipboard operation
material copied to clipboard

Using ng-show/ng-if inside md-item-templates within an md-autocomplete directive breaks md-virtual-repeat height calculation

Open jualvarez opened this issue 11 years ago • 4 comments

Height for the item template seems to be calculated before the ng-if or ng-show directives are evaluated, which causes the height of the li element to be wrongly calculated.

The following codepen shows this behaviour: https://codepen.io/jualvarez/pen/ojZwWN

image

Try typing in "n" in the state for example, and you will notice a big blank space at the bottom of the scroll. Seems like the div with the ng-show is present at the time of the height calculation. The opposite would happen if you change ng-show with ng-if.

jualvarez avatar Oct 02 '15 21:10 jualvarez

+1

cpae avatar Oct 05 '15 10:10 cpae

+1

mramanauskas avatar Oct 12 '15 13:10 mramanauskas

Any word on this?

samweatherly avatar Jul 13 '16 02:07 samweatherly

If you wanted a super hacky way to do this, you can use both ng-show and ng-if and the effects cancel each other out.

I had a reasonable use for this hack as I wanted to show two completely different md-item-templates depending on a boolean so I used ng-show for one and ng-if for the other.

UPDATE: Unfortunately I'm realising that this hack isn't consistent, it sometimes renders ok, sometimes there's too much space, sometimes to little.

TwoRice avatar Jul 21 '17 15:07 TwoRice