Skip to content

Commit

Permalink
Merge pull request #13927 from alexnoise79/patch-2
Browse files Browse the repository at this point in the history
p-image lazy loading support
  • Loading branch information
cetincakiroglu committed Oct 25, 2023
2 parents 5293243 + 27f4c78 commit c0b3771
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/components/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { FocusTrapModule } from 'primeng/focustrap';
selector: 'p-image',
template: `
<span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
<img [attr.src]="src" [attr.srcset]="srcSet" [attr.sizes]="sizes" [attr.alt]="alt" [attr.width]="width" [attr.height]="height" [ngStyle]="imageStyle" [class]="imageClass" (error)="imageError($event)" />
<img [attr.src]="src" [attr.srcset]="srcSet" [attr.sizes]="sizes" [attr.alt]="alt" [attr.width]="width" [attr.height]="height" [attr.loading]="loading" [ngStyle]="imageStyle" [class]="imageClass" (error)="imageError($event)" />
<button type="button" class="p-image-preview-indicator" (click)="onImageClick()" #previewButton [ngStyle]="{ height: height + 'px', width: width + 'px' }" style="border: 'none';">
<ng-container *ngIf="indicatorTemplate; else defaultTemplate">
<ng-container *ngTemplateOutlet="indicatorTemplate"></ng-container>
Expand Down Expand Up @@ -144,6 +144,11 @@ export class Image implements AfterContentInit {
* @group Props
*/
@Input() height: string | undefined;
/**
* Attribute of the image element.
* @group Props
*/
@Input() loading: 'lazy' | 'eager' | undefined;
/**
* Target element to attach the dialog, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @group Props
Expand Down

1 comment on commit c0b3771

@vercel
Copy link

@vercel vercel bot commented on c0b3771 Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.