如何隐藏ngb轮播指标和上一个下一个控件 [英] how to hide ngb-carousel indicators and prev-next control

查看:55
本文介绍了如何隐藏ngb轮播指标和上一个下一个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法通过CSS隐藏ngb-carousel指示器和上一个下一个控件, 定位到CSS类是行不通的. 可以隐藏它吗?

I can't hide the ngb-carousel indicators and prev-next control trough the css, targeting the css class wouldn't work. Is there any option to hide it?

推荐答案

为了影响ng-bootstrap组件的CSS,必须禁用ViewEncapsulation.

In order to affect the css of the ng-bootstrap components, you have to disable ViewEncapsulation.

从@ angular/core导入:

Import it from @angular/core:

import { ViewEncapsulation } from '@angular/core'

然后在@Component声明中对此组件禁用它:

Then disable it for this component in the @Component declaration:

@Component({
  encapsulation: ViewEncapsulation.None,
  selector: 'your-template-name',
  styleUrls: ['your-template-name.component.scss'],
  template: ` 
... `
})

然后,您可以按预期在css文件中定位Bootstrap类等.

Then you can target the Bootstrap classes etc. as you'd expect in your css file.

您要基于每个组件禁用此功能,并且仅在需要时禁用.

You want to disable this on a per-component basis, and only when you need to.

这篇关于如何隐藏ngb轮播指标和上一个下一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆