ngx-bootstrap tooltip not showing up in angular2

4.3k views Asked by At

I have an angular-cli application and need to include tooltip for a button here is my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {BenefitsManagementModule} from './benefits-management/benefits-management.module';
import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component';
import { AuthService } from './auth/auth.service';
import {AppRoutingModule} from './app-routing.module';
import { TooltipModule } from 'ngx-bootstrap';

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    BenefitsManagementModule,
    AppRoutingModule,
     TooltipModule.forRoot()
  ],
  providers: [
    AuthService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { };

here is my html for button

<div style="margin:0 auto; width: 65%; margin-top:3%;">
    <button type="submit"  
            [disabled]="!benefitScheduleForm.valid" 
            class="btn btn-md btn-primary" 
            style="float:left;"
            >Add
    </button>
    <button type="button" 
            tooltip="mytooltip"  
            class="btn btn-md btn-primary" 
            style="float:right;" 
            (click)="cancel()">Cancel</button>
</div>

Can anybody help me out?

1

There are 1 answers

0
BezBran On

I was facing the same issue. The solution was to set the opacity property to 100.

.tooltip {
  opacity: 100;
}