Skip to content
@ng-doc/app / Class

NgDocImageViewerComponent

Wraps an image of the page: clicking it, or pressing Enter or Space on it, opens the image at its natural size, scaled down to fit the window.

An image inside a link keeps the link's behaviour, and an image with an empty alt is decorative: neither becomes a button.

Decorators
@Component
Selectors
ng-doc-image-viewer
DeclarationTypeScript
@Component({ … })
export class NgDocImageViewerComponent { … }

Members

Constructor

1
()
—

Properties

9
alt: InputSignal<string>
readonly input()required

Alternative text of the image.

element: HTMLElement
protectedreadonly
—
image: Signal<TemplateRef<any>>
protectedreadonly
—
opened: WritableSignal<boolean>
protectedreadonly

Whether the scaled image is open.

protectedreadonly
—
overlayRef?: NgDocOverlayRef<unknown> | undefined
protected
—
size: WritableSignal<ZoomSize>
protectedreadonly

The size of the opened image.

src: InputSignal<string>
readonly input()required

Source of the image.

window: Window | null
protectedreadonly
—

Methods

3
(): void

Opens the image at its natural size, scaled down to fit the window, unless the image is not interactive. The image grows from its place on the page.

(): boolean
protected

Whether the image opens: it has a text alternative and is not inside a link. The page processor moves the host into place before change detection, so the check reads the DOM where the image ends up.

(…): void
protected

Opens the image on Space without scrolling the page.

Symbol
Kind
Class
Decorators
@Component
Selectors
ng-doc-image-viewer
Scope
@ng-doc/app
Edit this page