src/pipes/nested-attribute.pipe.ts
name | nestedAttribute |
transform |
transform(value: any, attr: string)
|
Defined in src/pipes/nested-attribute.pipe.ts:8
|
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;
}
}