Angular material 2 autocomplete position wrong

Viewed 3171

I have a problem with autocomplete of material 2.

In my case, I populate the list when the user write down something in the input, but the div(panel) with the options always appear bellow (If the screen is small I have to scroll down the page). It should appear above the input field when screen is small.

I think the problem is that the position of the panel is only initialised at the beginning when the input is clicked. Anyone can help me with any solution? Is there a way to reset positionY when the list is updated?

Thanks

2 Answers

For me the problem was core css classes missing from the project.

[Fix] in style.css, at top level, add:

@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
Related