Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export the sourceFactory? #77

Open
Venipa opened this issue Aug 30, 2019 · 1 comment
Open

export the sourceFactory? #77

Venipa opened this issue Aug 30, 2019 · 1 comment

Comments

@Venipa
Copy link

Venipa commented Aug 30, 2019

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
Copy link
Author

Venipa commented Aug 30, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants