Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [nzTooltipContext] and provide it to the embedded view #6607

Closed
ppacher opened this issue Apr 15, 2021 · 2 comments · Fixed by #6948
Closed

Add [nzTooltipContext] and provide it to the embedded view #6607

ppacher opened this issue Apr 15, 2021 · 2 comments · Fixed by #6948

Comments

@ppacher
Copy link

ppacher commented Apr 15, 2021

What problem does this feature solve?

I'd like to re-use a <ng-template #templateRef> between multiple instances of [nzTooltipTitle] but need to have access to context variables like those produced by *ngFor. Right now I'm forced to created a <ng-template> in each ngFor iteration. This would also allow the reuse of a template accross different *ngFor instances.

The same applies for related APIs like nz-popover.

What does the proposed API look like?

<h1>Events Today</h1>
<ul>
    <li *ngFor="let event of events.today" nz-tooltip [nzTooltipTitle]="tooltipTemplate" [nzTooltipContext]="{$implicit: event}">
       {{ event.summary }}
    </li>
</ul>

<h1>Events Tomorrow</h1>
<ul>
    <li *ngFor="let event of events.tomorrow" nz-tooltip [nzTooltipTitle]="tooltipTemplate" [nzTooltipContext]="{$implicit: event}">
       {{ event.summary }}
    </li>
</ul>

<ng-template #tooltipTemplate let-event>
    <!-- imagine some more complicated or layouted content -->
    <b>{{ event.description }}</b>
</ng-template>
```<!-- generated by ng-zorro-issue-helper. DO NOT REMOVE -->
@ppacher
Copy link
Author

ppacher commented Apr 15, 2021

Just after creating this issue I found #4706 which basically requests a similar solution for nz-dropdown.

@wzhudev
Copy link
Member

wzhudev commented Aug 26, 2021

Will do (sorry I have been occupied by other things).

wzhudev pushed a commit to wzhudev/ng-zorro-antd that referenced this issue Aug 26, 2021
wzhudev pushed a commit to wzhudev/ng-zorro-antd that referenced this issue Nov 23, 2021
simplejason pushed a commit that referenced this issue Nov 25, 2021
* feat(module:tooltip): support tooltip template context

close #6607

* docs(module:tooltip): change doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants