简体   繁体   English

样式 ng2-bootstrap 的预先输入列表项

[英]Style ng2-bootstrap's typeahead list-items

Problem:问题:

ng2-boostrap typeahead 透明背景

I want the results to be below each other (full width) and not to have a transparent background.我希望结果彼此低于(全宽)并且没有透明背景。 I right clicked one of the items and clicked 'inspect' so I figured out what to use as a selector.我右键单击其中一个项目并单击“检查”,因此我想出了将什么用作选择器。

What I have tried:我尝试过的:

ul.dropdown-menu li {
background-color: black !important;
opacity: 1 !important;
color: yellow !important;

} }

Didn't change a thing, so either I'm not selecting it right or I don't know.没有改变任何事情,所以要么我没有选择它,要么我不知道。 I have a custom template:我有一个自定义模板:

<template #customItemTemplate let-model="item" let-index="index">
    <h5 style="width: 100%">{{model.title || model.name}}</h5>
</template>

but even in-line style didn't change a thing.但即使是内嵌样式也没有改变任何事情。

Question:题:

How can I style the results?如何设置结果样式?

PS: I figured it might be useful to mention that I'm using MaterializeCSS. PS:我认为提及我正在使用 MaterializeCSS 可能很有用。

我在optionsListTemplate公开了TypeaheadDirective optionsListTemplate输入,因此您可以完全覆盖 typeahead 结果模板;) 默认源代码,您可以在此处查看: https : //github.com/valor-software/ng2-bootstrap/blob/development/ src/typeahead/typeahead-container.component.ts#L22-L32

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM