A toolkit of Angular directives designed to build a fully customizable avatar image component, will a fallback to represent the image.

Avatar
WP
EM

Installation

Add and import the module into your imports section.

Module

Loading syntax highlighter...

Standalone directives

Loading syntax highlighter...

Anatomy

Directive's set structure.

<docs-anatomy [node]="componentStructure" />

Input props

AvatarRoot Attribute

The root directive for the avatar. Handles the avatar state. It doesn't have any inputs, outputs or attributes.

AvatarImage Attribute   Optional

A directive to listen the image render.

<docs-table [columns]="columnsInput" [rows]="itemInputRows" />

Output Description Returns
loadingStatusChange A callback invoked when the loading status store of the image changes. LoadingStatus

AvatarFallback Structural   Optional

Use this directive to show a fallback when the image is not available.

<docs-table [columns]="columnsInput" [rows]="headerInputRows" />

State

AvatarStateService allows to load and listen the status of an image.

Access directive API with exportAS

We can access the state of the avatar using a template variable. All the directives expose themself with the same name. We have access to the directive's attributes and also the state service.

Example

We could use it with any other directive. For example with #image="vacAvatarRoot" and access the state.

<docs-code [code]="stateExample" language="html" />

State API - AvatarStateService

Documentation for the avatar state service API.

Variables

<docs-table [columns]="stateVarsColumns" [rows]="stateRows" />

Methods

<docs-table [columns]="stateMethodsColumns" [rows]="stateMethodRows" />

Types/Interfaces

Avatar interfaces that you can import.

Loading syntax highlighter...