温馨提示:本文翻译自stackoverflow.com,查看原文请点击:angular - Ngx-bootstrap Tooltips not Showing

angular - Ngx-bootstrap工具提示未显示

发布于 2020-03-27 11:45:08

我在带有Bootstrap 4.3.1的Angular 7项目中使用ngx-bootstrap 4.0.1,我需要在应用程序的某些元素中添加工具提示。我按照文档进行了所有设置,但是无法显示工具提示。也没有在Stack Overflow或其他论坛中找到任何可帮助解决我问题的东西。

app.module.ts:

import { ModalModule, TooltipModule } from 'ngx-bootstrap';

@NgModule({imports: [TooltipModule.forRoot(),...]})

component.html:

<button type="button" class="btn btn-primary" tooltip="Bazinga!">
      Bazinga
</button>

我在这里想念什么?

更新:添加了package.json信息

"dependencies": {
  "@angular/animations": "^7.2.0",
  "@angular/cdk": "^7.3.7",
  "@angular/common": "~7.2.0",
  "@angular/compiler": "~7.2.0",
  "@angular/core": "~7.2.0",
  "@angular/forms": "~7.2.0",
  "@angular/platform-browser": "~7.2.0",
  "@angular/platform-browser-dynamic": "~7.2.0",
  "@angular/router": "~7.2.0",
  "@ckeditor/ckeditor5-angular": "^1.0.1",
  "@ckeditor/ckeditor5-build-classic": "^12.0.0",
  "@ng-select/ng-select": "^2.17.0",
  "angular-highcharts": "^7.2.0",
  "angular2-uuid": "^1.1.1",
  "bootstrap": "^4.3.1",
  "core-js": "^2.5.4",
  "highcharts": "^7.1.1",
  "jquery": "^3.3.1",
  "ngx-bootstrap": "^4.0.1",
  "ngx-infinite-scroll": "^7.1.0",
  "ngx-ui-switch": "^8.0.1",
  "rxjs": "~6.3.3",
  "select2": "^4.0.6-rc.1",
  "select2-bootstrap4-theme": "^1.0.0",
  "tslib": "^1.9.0",
  "zone.js": "~0.8.26"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~0.13.0",
  "@angular/cli": "~7.3.3",
  "@angular/compiler-cli": "~7.2.0",
  "@angular/language-service": "~7.2.0",
  "@fortawesome/fontawesome-free": "^5.7.2",
  "@types/bootstrap": "^4.3.0",
  "@types/jasmine": "~2.8.8",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "@types/select2": "^4.0.48",
  "codelyzer": "~4.5.0",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~4.0.0",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~2.0.1",
  "karma-jasmine": "~1.1.2",
  "karma-jasmine-html-reporter": "^0.2.2",
  "protractor": "~5.4.0",
  "ts-node": "~7.0.0",
  "tslint": "~5.11.0",
  "typescript": "~3.2.2"
}

查看更多

查看更多

提问者
Ricky
被浏览
73
Lucho 2019-07-04 02:03

为了使样式生效,您是否完成了Bootstrap CSS 安装说明

两种有效的方法取决于您构建应用程序的方式。

要么包含CDN,要么在您的index.html中包含CDN,其中包括:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">

或通过在此处回答的angular-cli.json将其包含在应用程序样式构建中的CSS捆绑包中