简体   繁体   English

如何在angular 2快速入门解决方案上配置与mdl-select关联的CSS

[英]How to configure css associated to mdl-select on angular 2 quickstart solution

I am trying to use an mdl-select component in a form on angular 2 but the component is showing in drop drown state the whole time. 我正在尝试以对角2的形式使用mdl-select组件,但该组件始终处于下降淹没状态。 I assume it is because I have not associated css with it but am unsure how to do this in angular 2 quickstart solution. 我认为这是因为我没有将CSS与之关联,但是不确定如何在angular 2 quickstart解决方案中做到这一点。 Any guidance appreciated... 任何指导表示赞赏...

enter image description here 在此处输入图片说明

Thanks:) 谢谢:)

I had the same problem. 我有同样的问题。 After trying different things, this is what worked for me: I added SASS styles .scss to 'styles' array of angular-cli.json. 在尝试了不同的方法之后,这对我有用:我将SASS样式.scss添加到angular-cli.json的“样式”数组中。 Instead of .css files to index.html. 而不是将.css文件添加到index.html。 And, we have to add scss for popover component, too, as that is the one used internally. 并且,我们还必须为弹出框组件添加scss,因为这是内部使用的组件。 You don't have to import the popover component, though, unless you are using it elsewhere. 但是,除非您在其他地方使用它,否则不必导入popover组件。

angular-cli.json angular-cli.json

"styles": [ “样式”:[

    "styles.css",

    "../node_modules/@angular2-mdl-ext/select/select.scss",

    "../node_modules/@angular2-mdl-ext/popover/popover.scss"
  ],

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

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