Guest User

Untitled

a guest
Jan 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import { Pipe, PipeTransform } from '@angular/core';
  2.  
  3. @Pipe({
  4. name: 'shortName'
  5. })
  6.  
  7. export class ShortName implements PipeTransform {
  8. transform(value: any, short:boolean): any {
  9. if(short){
  10. let temp = new Array();
  11. temp = value.split(' ');
  12. return temp[0] + ' ' + temp[1].substr(0,1);
  13. }
  14. return value;
  15. }
  16. }
Add Comment
Please, Sign In to add comment