-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Button lose class style after label update with after primeng 9.1.0 #8996
Comments
i have same issue with PrimeNG version: 9.1.2 and Angular version: 9.1.11 |
I have same issue ... PrimeNG version: 9.1.2 and Angular version: 9.1 |
I have this problem too. There is a simple solution, but the PrimeNG team does not apply it |
PrimeNG team! Please do some thing about this! |
@ALL Thanks for feedback. Updated bug description. Primeng 9.1.0 seems the latest version without this bug. |
a possible soultion is to hold initial css classes in a private field like this : ngAfterViewInit() {
this._initialStyleClass = this.el.nativeElement.className;
....
}
private _initialStyleClass : string; // introduce a new field to hold the initial css classes
setStyleClass() {
let styleClass = this.getStyleClass();
this.el.nativeElement.className = styleClass + this._initialStyleClass;
} |
@yigitfindikli We should add it to 9.x LTS as well. |
This is still an issue when using [ngClass] [class.class-name] bindings with buttons. If you dynamically change the text of the button which also triggers a class change, the dynamic class gets overridden. On prime 11. |
Still have it with primeng 12 angular 12 when using [ngClass] , any solution ? |
I found workaround for this scenario, try to add method that calculates the classes instead of ngClass and use it's bad practice, but it works :) |
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
Bug with Primeng 9.1.2 and angular 10:
https://stackblitz.com/edit/github-qbkr34?file=src%2Fapp%2Fapp.component.html
Bug with Primeng 9.1.3 and angular 9:
https://stackblitz.com/edit/github-f3ydbw?file=package.json
Work with Primeng 9.1.0 and angular 9:
https://stackblitz.com/edit/github-f3ydbw-vsqqg3?file=package.json
Current behavior
If label changed dynamically, the style by
class
is lost.Just with angular 10 observed, not with 9. I'm not sure if this is an error of Angular or Primeng.Expected behavior
No style change on update.
Minimal reproduction of the problem with instructions
Use dynamic label update:
´<button pButton [label]="counter.toString()">´
What is the motivation / use case for changing the behavior?
Works without problems with Angular 9.Works without problems with primeng 9.1.0.
Please tell us about your environment:
Language: [all | TypeScript X.X | ES6/7 | ES5]
Node (for AoT issues):
node --version
= 12The text was updated successfully, but these errors were encountered: