File

src/pipes/nested-attribute.pipe.ts

Metadata

name nestedAttribute

Methods

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

@Pipe({
  name: 'nestedAttribute'
})
export class NestedAttributePipe implements PipeTransform {

  transform(value: any, attr: string): any {
    if (value instanceof Object && attr) {
      return value[attr];
    }
    return value;
  }

}

results matching ""

    No results matching ""