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

ERROR TypeError: this.rootEl?.setAttribute is not a function after migration to v19 #17419

Open
2 of 4 tasks
eciuca opened this issue Jan 16, 2025 · 0 comments
Open
2 of 4 tasks
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@eciuca
Copy link

eciuca commented Jan 16, 2025

Describe the bug

user-list.component.html:79 ERROR TypeError: this.rootEl?.setAttribute is not a function
at Tooltip.ngAfterViewInit (primeng-basecomponent.mjs:58:26)
at Tooltip.ngAfterViewInit (primeng-tooltip.mjs:267:15)
at callHookInternal (core.mjs:4277:14)
at callHook (core.mjs:4304:13)
at callHooks (core.mjs:4258:17)
at executeInitAndCheckHooks (core.mjs:4208:9)
at refreshView (core.mjs:14964:21)
at detectChangesInView (core.mjs:15105:9)
at detectChangesInViewIfAttached (core.mjs:15065:5)
at detectChangesInEmbeddedViews (core.mjs:15024:13)

This is line 79:
<app-warehouse ngDefaultControl [ngModel]="(user.warehouse$ | async) || undefined" />

and ngModel is defined like this
ngModel = model<Warehouse>();

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/github-ezuftcgh-xq53ixgg?file=src%2Fapp%2Fwarehouse.component.html

Environment

Chrome browser

Angular version

19.1.0

PrimeNG version

v19

Node version

22.11.0

Browser(s)

Chrome

Steps to reproduce the behavior

Just go to a page displaying the component

Expected behavior

This error should not be thrown.

This is the failing code:

ngAfterViewInit() {
        this.rootEl = this.el?.nativeElement;
        if (this.rootEl) {
            this.rootEl?.setAttribute(this.attrSelector, ''); // maybe an additional check is needed here to see if the element has the setAttribute method ?
        }
    }
@eciuca eciuca added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant