Socket
Socket
Sign inDemoInstall

ng2-avatar

Package Overview
Dependencies
5
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ng2-avatar

Angular Avatar (ng2-avatar) is a simple and lightweight avatar component


Version published
Weekly downloads
106
decreased by-11.67%
Maintainers
1
Install size
182 kB
Created
Weekly downloads
 

Changelog

Source

2.3.1 (2018-04-02)

Bug Fixes

  • lint: add missing semicolon (bacdaf6)
  • name: use first character as fallback for non-ASCII case (5b32259)

<a name="2.3.0"></a>

Bug Fixes

  • @dist: added dist again to gitignore (5a81fe8)
  • ssr: transpiled all js file to es5 using babel preset es2015 (new gulp task) (a2b5d5b)

<a name="2.2.1"></a>

Readme

Source

ng2-avatar

npm version, Build Status Coverage Status dependency Status devDependency Status license

Angular Avatar (ng2-avatar) is a simple and lightweight avatar component

Demo

View all the directives in action at https://snics.github.io/ng2-avatar

Dependencies

  • Angular (requires Angular 2 or higher, tested with 2.0.0)

Installation

Install above dependencies via npm.

Now install ng2-avatar via:

npm install --save ng2-avatar

SystemJS

Note:If you are using SystemJS, you should adjust your configuration to point to the UMD bundle. In your systemjs config file, map needs to tell the System loader where to look for ng2-avatar:

map: {
  'ng2-avatar': 'node_modules/ng2-avatar/bundles/ng2-avatar.umd.js',
}

Once installed you need to import the main module:

import { AvatarModule } from 'ng2-avatar';

The only remaining part is to list the imported module in your application module. The exact method will be slightly different for the root (top-level) module for which you should end up with the code similar to (notice AvatarModule.forRoot()):

import { AvatarModule } from 'ng2-avatar';

@NgModule({
  declarations: [
    AppComponent, 
    ...
  ],
  imports: [
    AvatarModule.forRoot(), 
    ...
  ],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

Other modules in your application can simply import AvatarModule:

import { AvatarModule } from 'ng2-avatar';

@NgModule({
  declarations: [OtherComponent, ...],
  imports: [LibModule, ...], 
})
export class OtherModule {
}

Usage

  <avatar [email]="email" [displayType]="'circle'"></avatar>
  <input type="email" [(ngModel)]="email">

Configuration

configuration optiontypedefaultdescription
emailStringnoneThis email is for generated the initials letters or get the picture from Gravatar API (required)
namestringnoneThis name is for generated the initials letters (required)
sizenumber100Is the size of the image and avatar
backgroundstringRandom colorThe background colors for the letter's avatar
displayTypestringcirclenone, circle, rounded
letterstring?These are the default letter
defaultProtocolstringnullspecifies a protocol or uses protocol-agnostic gravatar url when empty

License

Copyright (c) 2017 Nico Swiatecki. Licensed under the MIT License (MIT) - Initial work - Snics

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Last updated on 02 Apr 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc