bia-framework
Version:
Bia Framework to work with angular 2
21 lines (18 loc) • 446 B
text/typescript
import {PipeTransform, Pipe} from "@angular/core";
/**
* Created by jd on 03/05/2016.
*/
({
name: 'objectOrArray'
})
export class ObjectOrArrayPipe implements PipeTransform
{
public transform(items:Array<any>, args:any[]):any
{
var selectedProp = args.toString();
if (selectedProp != null)
return items.map(a => a[selectedProp]);
else
return items;
}
}