Ng-bootstrap with angular 4 not showing tooltip

Ng-bootstrap with angular 4 not showing tooltip



I am using ng-bootstrap 3.0.0 with angular 4 to show the bootstrap tooltip on hover over a icon. But for unknown reasons, the tooltip doesnt show up on hover of the icon.
This is my code:


<div class="col-md-1" style="margin-left:20px;" placement="bottom" ngbTooltip="Import">
<input type="file" id="fileLoader" name="files" style="display:none" accept=".csv" (change)="uploadFileToDataManager($event)"
multiple/>
<div id="btnUpload" class="import-icon" tabindex="0" role="button">
<div style="margin-top:5px">
<span style="float:left;" class="importIconFont icon-cloud-import"></span>
<!--<a class="exportIconFont icon-cloud-export"></a>-->
<!--<span style="color:#263a47;font-family:ev;margin-left: 10px;">Upload</span>-->
</div>
</div>
</div>



I have included the module in app.module :


import NgbModule from '@ng-bootstrap/ng-bootstrap';
@NgModule(
declarations: [
],
imports: [
BrowserModule,
HttpClientModule,
HttpModule,
NgbModule.forRoot()
],
providers: ,
bootstrap:
)



What am i doing wrong here?





here ng-bootstrap.github.io/#/getting-started are the minimal versions dependencies...if you are using -v3.0 then you have to use angular -v6.0
– Aniket Avhad
Aug 23 at 5:52





@AniketAvhad So does this mean i cannot use this with Angular 4?
– UI Dev
Aug 23 at 6:01




1 Answer
1



You cant use ng-bootstrap for angular 4 project read more here.



But, you can use ngx-bootstrap by installing it from npm install ngx-bootstrap@next and integrating the ngx-bootstrap tooltip from taking reference from ngx-bootstrap tooltip


npm install ngx-bootstrap@next



The ngx-bootstrap support is added with a @next version of ngx-bootstrap(see the support here)



For closing the tooltip after 2 seconds, add two custom functions in .ts as


PopoverEnabled()
this.stopPopover();


stopPopover()
setTimeout(() =>
pop.hide();
, 2000);



and use in html , in which div you have the tooltip code as


<div (mouseenter)="PopoverEnabled()" (mouseleave)="stopPopover()"></div>





Thank you so much ! This worked great :)
– UI Dev
Aug 23 at 6:22





How can i hide the tooltip after 2 seconds?
– UI Dev
Aug 23 at 10:30





you want to show the tooltip on mouse-enter and want the tooltip to hide after 2 seconds? Is this what you need?
– BlizZard
Aug 23 at 10:36





Yes thats right. It should hide after 2 seconds as well as hide when i move the mouse away from the icon
– UI Dev
Aug 23 at 10:36





I have updated my answer as per your requirement, please let me know if the functionality is working or it need some more research.
– BlizZard
Aug 23 at 11:01






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)