File

src/property/properties.pipe.ts

Description

Returns a sub-list of properties from a list of properties using an array of IDs.

Metadata

name arProperties

Methods

transform
transform(properties: PropertySet, ids: Array)
Parameters :
Name Type Optional Description
properties PropertySet
ids Array<string>
Returns : PropertySet
import { Pipe, PipeTransform } from '@angular/core';

import { PropertySet } from '../models/index';

/**
 * Returns a sub-list of properties from a list of properties using an array of IDs.
 */
@Pipe({name: 'arProperties'})
export class PropertiesPipe implements PipeTransform {
    transform(properties: PropertySet, ids: Array<string>): PropertySet {
        let set: PropertySet = [];
        properties.filter(prop => {
            for (let id of ids) {
                if (prop.id === id) {
                    set.push(prop);
                }
            }
        });
        return set;
    }
}

results matching ""

    No results matching ""