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

Need exportAs in NgxPopperjsDirective to export directive so that it can be used like template reference in template. #15

Closed
pavandixit93 opened this issue Sep 29, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request not a bug Issues which aren't really bugs

Comments

@pavandixit93
Copy link

This was already provided in Mr Frankel's ngx-popper repo.
Reference: https://github.com/MrFrankel/ngx-popper/blob/master/src/popper-directive.ts#L17-L19
How it helps/ Where is usage:

<div 
    #popperRef="popper"
    popper="As text"
    [popperTrigger]="'hover'"
    [popperPlacement]="'bottom'"
    [customDir]="popperRef">
    <p class="bold">Pop</p>
</div>

Here i am getting the directive reference using #popperRef="popper" and passing same to the my customDir, which has custom functionality around popper.
Can we add same in NgxPopperjsDirective? That would be really helpful. I know the other workaround but if we use exportAs it will keep code simple and will reduce the lines of code needed for workaround.

@tonysamperi tonysamperi self-assigned this Sep 30, 2021
@tonysamperi tonysamperi added enhancement New feature or request not a bug Issues which aren't really bugs labels Sep 30, 2021
@tonysamperi
Copy link
Owner

Hello @pavandixit93
yes I guess I can throw in the exportAs in the next release...
Altough I don't really see the upside. What "other workaround" are you talking about?

@pavandixit93
Copy link
Author

Hi @tonysamperi Thanks for the update, The change is simple and i hope that will come soon.
Other workaround cab be by using ViewChild as shown below, but doing this increases the lines of code.

custom-popper.component.ts:

@ViewChild('popperRef', {read: NgxPopperjsDirective}) popperRef: NgxPopperjsDirective

custom-popper.component.html:

<div 
    #popperRef
    popper="As text"
    [popperTrigger]="'hover'"
    [popperPlacement]="'bottom'"
    [customDir]="popperRef">
    <p class="bold">Pop</p>
</div>

@tonysamperi
Copy link
Owner

I'll give you a hint, there's a much much simpler solution without using ViewChild 😉
Anyway I'm dealing with a few things at this time, but I'll try to release an update in about 1 month...

Bye!

@tonysamperi
Copy link
Owner

Actually let's keep this open to track the resolution.

@tonysamperi tonysamperi reopened this Oct 4, 2021
Repository owner locked as resolved and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request not a bug Issues which aren't really bugs
Projects
None yet
Development

No branches or pull requests

2 participants