首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ng-bootstrap:在项目中使用scss

ng-bootstrap:在项目中使用scss
EN

Stack Overflow用户
提问于 2017-10-25 17:36:33
回答 1查看 621关注 0票数 1

我的angular项目正在使用scss,在我切换到ng-bootstrap之前,我遵循以下指导原则在我的angular项目中集成了bootstrap和scss:https://shermandigital.com/blog/bootstrap-sass-with-angular-cli/

现在我切换到ng-bootstrap。有没有类似的东西?

EN

回答 1

Stack Overflow用户

发布于 2017-10-26 15:04:00

Net,在您编写的angular项目中

代码语言:javascript
复制
npm install --save @ng-bootstrap/ng-bootstrap

在主引导导入{NgbModule}中,从‘@ng- module.ts /ng-bootstrap’;

代码语言:javascript
复制
@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgbModule.forRoot(), ...],
  bootstrap: [AppComponent]
})
export class AppModule {
}

或者在module.ts中

代码语言:javascript
复制
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [OtherComponent, ...],
  imports: [NgbModule, ...]
})
export class OtherModule {
}

然后,你可以写一个组件,例如

代码语言:javascript
复制
<button type="button" class="btn btn-outline-secondary" placement="top" ngbTooltip="Tooltip on top">
  Tooltip on top
</button>

如果您已经以任何方式(*)导入了bootstrap.css.4.0,您可以看到正确的工具提示,否则您可以看到工具提示,但格式不正确。

(*)在angular-cli.json中导入css是非常值得的。

代码语言:javascript
复制
"styles": [
        "styles.css",
        "../bootstrap.css"
      ], 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46928937

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档