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

Cannot read property 'trim' of undefined with ButtonDirective #10354

Closed
mnhock opened this issue Jun 22, 2021 · 6 comments · Fixed by #10348
Closed

Cannot read property 'trim' of undefined with ButtonDirective #10354

mnhock opened this issue Jun 22, 2021 · 6 comments · Fixed by #10348
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@mnhock
Copy link

mnhock commented Jun 22, 2021

If you have a PrimeNG PRO Support subscription please post your issue at;

https://pro.primefaces.org

where our team will respond within 4 business hours.

If you do not have a PrimeNG PRO Support subscription, fill-in the report below. Please note that
your issue will be added to the waiting list of community issues and will be reviewed on a first-come first-serve basis, as a result, the support team is unable to guarantee a specific schedule on when it will be reviewed. Thank you for your understanding.

Current Queue Time for Review
Without PRO Support: ~8-12 weeks.
With PRO Support: 1 hour

I'm submitting a ... (check one with "x")

[ x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.

https://stackblitz.com/github/primefaces/primeng-issue-template

Current behavior
Cannot read property 'trim' of undefined form Domhandler

Error will be thrown:
core.js:6456 ERROR TypeError: Cannot read property 'trim' of undefined
at Function.addMultipleClasses (:4200/vendor.js:137611)
at ButtonDirective.createIconEl (:4200/vendor.js:132099)
at ButtonDirective.setIconClass (:4200/vendor.js:132114)
at ButtonDirective.set label [as label] (:4200/vendor.js:132132)
at setInputsForProperty (:4200/vendor.js:28676)
at elementPropertyInternal (:4200/vendor.js:27720)
at ɵɵpropertyInterpolate1 (:4200/vendor.js:33287)
at Module.ɵɵpropertyInterpolate (:4200/vendor.js:33250)

The bug was introduced with #10277

There must be a test in createIconEl method for line:
DomHandler.addMultipleClasses(iconElement, this.getIconClass());

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

  • PrimeNG version: 5.X
    12.0.0
@yigitfindikli yigitfindikli added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Jun 22, 2021
@yigitfindikli yigitfindikli added this to the 12.1.0-rc.1 milestone Jun 22, 2021
@Jakob-em
Copy link
Contributor

This is the problem that #10348 fixes

@j-be
Copy link

j-be commented Jun 24, 2021

Confirm issue.

For what it is worth: if you use primeng[.min].css you can add icon="p-hidden" to the button as a workaround for the time being.

@PeterHewat
Copy link

I encountered this issue while trying to dynamically update a pButton label with a pipe.
For what it's worth, here is the example I have come up with:
https://stackblitz.com/edit/issue-primeng-pbutton-dynamic-label

Using PrimeNG 12

@yigitfindikli yigitfindikli modified the milestones: 12.1.0-rc.1, 12.Future Jul 27, 2021
@mkoestner
Copy link

Same here. Label in pButton with a pipe and I get the same error after a change of the label value.

@avmesquita
Copy link

avmesquita commented Aug 4, 2021

Occurred with me when using ngx-translate.

To resolve the bug, momentarily use:

icon="pi"

like:

<button pButton icon="pi" label="{{ 'CONSTANT' | translate }} ...>

@john8329
Copy link

Same issue, using [label] with a translate pipe makes the button cry. The aforementioned hack temporarily fixes the issue, but a proper solution would be really appreciated.

@yigitfindikli yigitfindikli added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Oct 13, 2021
@yigitfindikli yigitfindikli self-assigned this Oct 13, 2021
@yigitfindikli yigitfindikli modified the milestones: 12.Future, 12.2.1 Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants