Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
ngx-gravatar
Advanced tools
The gravatar directive for angular 4 & 5+. It is AoT compatible.
Live demo here.
Play with ngx-gravatar here on stackblitz.
Install ngx-gravatar
via NPM, using the command below.
npm install --save ngx-gravatar
Import the GravatarModule
in your root application module AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { GravatarModule } from 'ngx-gravatar';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
// Import GravatarModule
GravatarModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
After importing the GravatarModule, you can use the ngx-gravatar directive in any components as below:
<img ngx-gravatar [email]="'example@mail.com'">
<img ngx-gravatar [email]="'example@mail.com'" size="30">
<img ngx-gravatar [email]="'example@mail.com'" size="30" src="assets/avatar.jpg">
<img ngx-gravatar [email]="'example@mail.com'" size="30" src="assets/avatar.jpg" [style]="styleObject">
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
email | string | requried | Email associated with Gravatar | |
src | string | optional | Custom image to use | |
preferGravatar | boolean | optional | false | If true , Gravatar will have higher priority. Otherwise, custom image will be loaded first. |
size | number | optional | 40 | Size of the avatar |
round | boolean | optional | true | Circle avatar |
cornerRadius | number | optional | 0 | Round the corner of square avatar. Only applied when round is set to false |
borderColor | string | optional | Specify the color of the border | |
borderWidth | string | optional | Specify the width of the border | |
style | object | optional | Style object that will be applied on the <img> tag | |
fallback | string | optional | retro | The fallback string of Gravatar. Possible values: blank , indenticon , mm , monsterid , retro , robohash , wavatar . |
Default configuration options can be set globally by using the .forRoot() method. Note that the input parameters that are passed into an ngx-gravatar element will override any custom global config options that have been set. Please see below for an example of how to override default configurations.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { GravatarModule, GravatarDefaultConfig, FALLBACK_TYPES } from 'ngx-gravatar';
const gravatarConfig: GravatarDefaultConfig = {
fallback: FALLBACK_TYPES.monsterid,
hasBorder: true,
borderColor: '#00ACC1',
}
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
// Import GravatarModule with custom configuration globally
GravatarModule.forRoot(gravatarConfig)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Option | Type | Required | Default | Description |
---|---|---|---|---|
hasBorder | boolean | optional | false | Specify whether to have border or not |
preferGravatar | boolean | optional | false | If true , Gravatar will have higher priority. Otherwise, custom image will be loaded first. |
size | number | optional | 40 | Size of the avatar |
round | boolean | optional | true | Circle avatar |
cornerRadius | number | optional | 0 | Round the corner of square avatar. Only applied when round is set to false |
borderRadius | string | optional | 50% | Only applied when round is set to true. |
borderColor | string | optional | #000000 | Specify the color of the border |
borderWidth | string | optional | 1 | Specify the width of the border |
borderStyle | object | optional | solid | Style object that will be applied on the <img> tag |
fallback | string | optional | retro | The fallback string of Gravatar. Possible values: blank , indenticon , mm , monsterid , retro , robohash , wavatar . |
MIT © t-ho
v2.0.0
FAQs
A customizable Gravatar for Angular applications.
The npm package ngx-gravatar receives a total of 846 weekly downloads. As such, ngx-gravatar popularity was classified as not popular.
We found that ngx-gravatar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.