We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
当图片还没有加载完成之前显示默认图片 如果图片加载失败 显示默认图片 已经使用指令对img的做了统一处理 但是nz-avatar无法生效 代码如下 @directive({ selector: 'img[default],img', host: { '[src]': 'src', '(load)': 'load()', '(error)': 'error()' } }) export class ImagePreloadDirective { @input() src: string; @input() default: string; @HostBinding('class') className;
constructor() { }
error() { this.src = this.default ? this.default : 'assets/img/logo.png'; }
load() { this.className = 'image-loaded'; }
}
[nzDefault]='默认图片地址';
The text was updated successfully, but these errors were encountered:
feat(module:avatar): support image load error event (#3893)
ab4bcbe
close #3223
feat(module:avatar): support image load error event (NG-ZORRO#3893)
fb5c789
close NG-ZORRO#3223
54a441e
hsuanxyz
Successfully merging a pull request may close this issue.
What problem does this feature solve?
当图片还没有加载完成之前显示默认图片 如果图片加载失败 显示默认图片
已经使用指令对img的做了统一处理 但是nz-avatar无法生效
代码如下
@directive({
selector: 'img[default],img',
host: {
'[src]': 'src',
'(load)': 'load()',
'(error)': 'error()'
}
})
export class ImagePreloadDirective {
@input() src: string;
@input() default: string;
@HostBinding('class') className;
constructor() {
}
error() {
this.src = this.default ? this.default : 'assets/img/logo.png';
}
load() {
this.className = 'image-loaded';
}
}
What does the proposed API look like?
[nzDefault]='默认图片地址';
The text was updated successfully, but these errors were encountered: