我的角度项目正在使用scss,在我切换到ng-bootstrap之前,我按照此指南在我的角度项目中集成了bootstrap和scss:https://shermandigital.com/blog/bootstrap-sass-with-angular-cli/
现在我切换到ng-bootstrap。有类似的东西吗?
答案 0 :(得分:0)
Net,在你写的角色项目中
npm install --save @ng-bootstrap/ng-bootstrap
在主模块中 从' @ ng-bootstrap / ng-bootstrap';
导入{NgbModule}@NgModule({
declarations: [AppComponent, ...],
imports: [NgbModule.forRoot(), ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
在module.ts中的OR
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
@NgModule({
declarations: [OtherComponent, ...],
imports: [NgbModule, ...]
})
export class OtherModule {
}
然后,你可以写一个组件,例如
<button type="button" class="btn btn-outline-secondary" placement="top" ngbTooltip="Tooltip on top">
Tooltip on top
</button>
如果您有ALREADY导入bootstrap.css.4.0 WHATEVER WAY(*),您可以看到工具提示正确,如果没有,您可以看到工具提示,但格式不正确。
(*)在angular-cli.json add
中导入css是值得的"styles": [
"styles.css",
"../bootstrap.css"
],