Angular HTML Content Tooltip Example

Hello Dev,

At this time, i we’ll present you angular html content material tooltip instance. This text will implement a angular 12 tooltip with html content material. step-by-step clarify angular 12 tooltip with html content material.

Someday we’d prefer to characteristic tooltip with HTML content material because of we’d like to point out thereforeme textual content as daring or as title so, right here we’re going to use npm ng2-tooltip-directive bundle for including tooltip with HTML content material.you should use this instance with in angular 6, angular 7, angular 8, angular 9, angular 10, angular 11 and angular 12 model app.

So let’s comply with few step to create instance of angular html content material tooltip instance.

Step 1: Set up New App

You’ll be able to simply set up angular app utilizing bellow command:


ng new myNewApp

Step 2: Set up ng2-tooltip-directive npm Package deal

we have to simply set up ng2-tooltip-directive in our angular app. so let’s utilizing bellow command:


npm i ng2-tooltip-directive

Step 3: Import TooltipModule

import TooltipModule module as like beneath code:
src/app/app.module.ts


import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
  
import { AppComponent } from './app.part';
import { TooltipModule } from 'ng2-tooltip-directive';
  
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    TooltipModule
  ],
  suppliers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Step 4: Replace Element Html File

we have to replace Element html file as like beneath code:
src/app/app.part.html


<h1>Angular HTML Content material Tooltip Instance</h1>
  
<button placement="prime" tooltip="<p>Hi there i am a <sturdy>daring</sturdy> textual content!</p>">
  Ex 1: Tooltip with HTML content material
</button>
  
<ng-template #HtmlContent>
  <p>Hi there i am a <sturdy>daring</sturdy> textual content!</p>
</ng-template>
  
<button [tooltip]="HtmlContent" contentType="template">
  Ex 2: Tooltip with template content material
</button>

run your app by beneath command


ng serve

I hope it should help you…

Komentar

Postingan populer dari blog ini

Laravel 8 Get HTTP Hostname

JQuery Drag And Drop Menu Example

Laravel 8 Share Social Media Button