如何隐藏ngb轮播指标和上一个下一个控件

Pri*_*ati 1 carousel ng-bootstrap angular

我无法通过css隐藏ngb-carousel指示器和prev-next控件,以css类为目标是行不通的。是否可以隐藏它?

Ste*_*ith 5

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

从@ angular / core导入:

import { ViewEncapsulation } from '@angular/core'
Run Code Online (Sandbox Code Playgroud)

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

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

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

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