HaithemMosbahi / ngx-avatar

Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

export the sourceFactory?

Venipa opened this issue · comments

Would be nice to programatically generate urls for the implementation with material2

import { Pipe, PipeTransform } from '@angular/core';
import { AvatarSource } from 'ngx-avatar';
import { SourceFactory } from 'ngx-avatar/lib/sources/source.factory';

@Pipe({
  name: 'gravatar'
})
export class GravatarPipe implements PipeTransform {

  constructor(private sourceFactory: SourceFactory) {}
  transform(value: string, [size]: [number]): any {
    return this.sourceFactory.newInstance(AvatarSource.GRAVATAR, value).getAvatar(size);
  }
}

yarn add https://github.com/Venipa/ngx-avatar#build/dev
if people want to try it