ng-matero / extensions

Angular Material Extensions Library.
https://ng-matero.github.io/extensions/
MIT License
393 stars 48 forks source link

[Tooltip] How to pass data dynamically to [mtxTooltip] directive ? #163

Closed AlonsoK28 closed 1 year ago

AlonsoK28 commented 1 year ago

Its possible to pass data dynamically inside of mtxTooltip directive to use it into template?

<ng-template #tooltipTpl> // how to get here the data arguments ?

nzbin commented 1 year ago

You can try the following way:

<div *ngFor="let result of searchResults">
  <button mat-raised-button [mtxTooltip]="tooltipTpl">Action</button>
  <ng-template #tooltipTpl>
    <img src="result.image">
  </ng-template>
</div>
AlonsoK28 commented 1 year ago

amazing

image

nzbin commented 1 year ago

I think the popover is better than tooltip if you want to show the image.

AlonsoK28 commented 1 year ago

I think the popover is better than tooltip if you want to show the image.

Looks amazin 😎

image

AlonsoK28 commented 1 year ago

I get the following error when update to @ng-matero/extensions@14.6.3

ERROR NullInjectorError: R3InjectorError(DashboardModule)[InjectionToken mtx-popover-scroll-strategy -> InjectionToken mtx-popover-scroll-strategy -> InjectionToken mtx-popover-scroll-strategy -> InjectionToken mtx-popover-scroll-strategy]: 
  NullInjectorError: No provider for InjectionToken mtx-popover-scroll-strategy!

I import only MtxPopoverModule into my module, I need some more?

nzbin commented 1 year ago

Which angular version do you use?

AlonsoK28 commented 1 year ago

Which angular version do you use?

Lastest Angular 14 https://www.npmjs.com/package/@angular/core/v/14.2.12

"@angular/animations": "^14.2.12", "@angular/cdk": "^14.2.3", "@angular/common": "^14.2.12", "@angular/compiler": "^14.2.12", "@angular/core": "^14.2.12", "@angular/fire": "^7.4.1", "@angular/flex-layout": "^14.0.0-beta.41", "@angular/forms": "^14.2.12", "@angular/material": "^14.2.3", "@angular/platform-browser": "^14.2.12", "@angular/platform-browser-dynamic": "^14.2.12", "@angular/router": "^14.2.12", "@angular/service-worker": "^14.2.12",

nzbin commented 1 year ago

I created an online example for v14 and I don't find any issues. https://stackblitz.com/edit/angular-ivy-2kqseo?file=src%2Fapp%2Fapp.component.ts

AlonsoK28 commented 1 year ago

its working very well