HaithemMosbahi / ngx-avatar

Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources
MIT License
236 stars 91 forks source link

export the sourceFactory? #77

Open Venipa opened 5 years ago

Venipa commented 5 years ago

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);
  }
}
Venipa commented 5 years ago

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