File

src/lib/pipes/split-initials/split-initials.pipe.ts

Metadata

Methods

transform
transform(value: string)
Parameters :
Name Type Optional
value string No
Returns : any
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'splitInitials'
})
export class SplitInitialsPipe implements PipeTransform {

  transform(value: string): any {
    if (value) {
      let userInitial = '';
      const name = value.split(' ');
      name.forEach(element => {
        userInitial = userInitial + element.charAt(0);
      });
      return userInitial;
    }
  }
}

results matching ""

    No results matching ""