答案 0 :(得分:1)
似乎无法在ng-bootstrap中更改position setting
所以我使用CSS覆盖它,但是使用它时要小心,避免使用过多的!important
语法
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%);
}
*/