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

the behavior of 'hidden' is incorrect when the value is 'undefined', and it is different from angular #6918

Closed
hungtcs opened this issue Aug 11, 2021 · 0 comments · Fixed by #6919

Comments

@hungtcs
Copy link
Contributor

hungtcs commented Aug 11, 2021

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-ivy-3tcdc8

Steps to reproduce

<button [hidden]="undefined">this is not hidden</button>
<!-- The buttons below should visible, but not -->
<button nz-button [hidden]="undefined">this is hidden</button>

What is expected?

button is visible correctly.

What is actually happening?

button is hidden becase button has hidden attribute.

Environment Info
ng-zorro-antd 12.0.1
Browser all browsers

if (this.hidden === true) {
this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
} else if (this.hidden === false || this.hidden === null) {
this.renderer.removeAttribute(this.elementRef.nativeElement, 'hidden');
} else if (typeof this.hidden === 'string') {
this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', this.hidden);

@hungtcs hungtcs changed the title the behavior of 'hidden' is incorrect when the value is 'undefined', and different from angular the behavior of 'hidden' is incorrect when the value is 'undefined', and it is different from angular Aug 11, 2021
hsuanxyz pushed a commit that referenced this issue Nov 4, 2021
- fix hidden attribute behavior
- make hidden behavior same as angular

Closes #6918

Co-authored-by: 文杰 刘 <wenjie.liu@easystack.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant