Reputation: 163
I have typeahead
from ngx-bootstrap
, and I want to locate it so that typeahead dropdown is in the centre of my input.
I mean something like this https://joxi.ru/82383oJCJ4gGyA
Thanks!
Upvotes: 1
Views: 1800
Reputation: 2244
It looks no way to change position setting in ng-bootstrap
So I use CSS to overwrite it, but it needs to be careful to use it to avoid having too much !important
syntax
app.component.css
// :host => only work in app.component.css
// :host ::ng-deep => look for selector `typeahead-container.dropdown-menu` in `app.component.css`
:host ::ng-deep typeahead-container.dropdown-menu {
left: 50%!important;
transform: translateX(-50%);
}
/*
// it will be compiled to this
[_nghost-c0] typeahead-container.dropdown-menu {
left: 50%!important;
transform: translateX(-50%);
}
*/
Upvotes: 2