ng-letter-avatar | Angular-js directive for the letter avatar similar to gmail

ng-letter-avatar directive

ng-letter-avatar

Stars : 10

Forks : 10

Created by uttesh

bower install ngletteravatar

Demo Download GitHub

<

h2> For the latest Angular, added ngletteravatar component to the ngu-utility, use ngu-utility for the latest angular2 or above versions

<

h2>

ng-letter-avatar Build Status

Gitter

AngularJS directive for simple data avatar like gmail/inbox. demo preview snaps :

demo demo demo demo demo demo demo demo demo demo

Quick start

bower install ngletteravatar or npm install ngletteravatar

or alternatively download and include ngletteravatar.js after angular.min.js. minified version ngletteravatar.min.js is under dist folder.

Add the ngLetterAvatar module as a dependency when creating your app, e.g.

var app = angular.module('myApp', ['ngLetterAvatar']);`

NO NEED TO INJECT in controller directly use in html.

Rendering

<p>
  <small>
     <ng-letter-avatar data="uttesh"></ng-letter-avatar>
  </small>
</p>

Option attirbutes

You can affect how letteravatar operates with the following settings:

namedefaultdescription
avatarcustombgcolorNo default valueUsing this attribute set the custom color for avatar background.
dynamicfalseSet this attribute to true if dynamically avatar needs to be generated on data change.
rotatedeg0Set this attribute required degrees of rotation of the avatar.
alphabetcolorsdefault color setUsing this attribute set the custom colors for the alphabets only.
charCount1Specifies the number of letters to displayed. to generate combined letter avatar of first name and last name which are separated by space then set the value to '2'
dataInput data i.e. email, names...etc -OR- If image already exists for item, set image URL or image data
height50pxset the height for the avatar
width50pxset the width for the avatar
fontWeight400set the font weight for the avatar
fontSize30pxset the font size for the letter
shapesquareset the shape for the avatar. set 'round' for rounded avatars
fontFamilyHelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica, Arial,Lucida Grande, sans-serifset the font Family of the avatar.
avatarborderfalseset the avatarborder to 'true' for the white border to avatar.
avatarcustomborderno default valueusing this attribute set the custom style to avatar borders i.e "border:5px solid black".

Contributions

For problems/suggestions please create an issue on Github.

Contributors

License

The MIT License

Copyright (c) 2015 Uttesh Kumar T.H. http://www.uttesh.com

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.

Javscript

Javascript plugin

Angular-js