Skip to content

AngularJS directive to set a default avatar with initials if user has not avatar image

License

Notifications You must be signed in to change notification settings

AitorRodriguez990/ng-default-avatar

Repository files navigation

Angular default avatar

AngularJS directive to show an user avatar. Set a default avatar with initials if user has not avatar image.

Demo

See the demo page with directive working.

Table of content

Install

Manual

Download lastest release from here.

Bower

Install bower package:

bower install --save ng-default-avatar

Include the following files in your app:

<script src="bower_components/ng-default-avatar/default-avatar.js"></script>

Add, if you want, the stylesheet too:

<link rel="stylesheet" href="bower_components/ng-default-avatar/default-avatar.css">

Add ngDefaultAvatar to your app's dependencies:

angular.module('myApplication', ['ngDefaultAvatar']);

Usage

<default-avatar name="Name" surname="Surname" image="UrlPath"></default-avatar>

Fields

name (string)

User name. Default value is ?.

surname (string) - Optional

User surname. Default value is an empty string.

image (string) - Optional

User image. Default value is an empty string.

Changelog

v1.0

  • Package available to install by Bower

v0.3

  • Add default values

v0.2

  • Improve files structure, directive's code and demo template

v0.1

  • First preview of directive with fields name, surname and image
  • Demo page

Copyright

Copyright (c) 2016-Present Aitor Rodríguez - Front End Factory. Directive licensed under the MIT License.