Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Pipe, PipeTransform} from '@angular/core';
- import {Idee} from '../Idee';
- @Pipe({
- name: 'ideaFilter'
- })
- export class IdeaFilterPipe implements PipeTransform {
- transform(idees: Idee[], text: string): Idee[] {
- let ideeTmp: Idee[] = [];
- if (text == null || text === '') {
- return idees;
- }
- idees.forEach(idee => {
- idee.domaines.forEach(
- domaine => {
- if (domaine.libelle === text) {
- // console.log(JSON.stringify(idee));
- ideeTmp.push(idee);
- }
- }
- );
- idee.comptences.forEach(
- competence => {
- if (competence.libelle === text) {
- // console.log(JSON.stringify(idee));
- ideeTmp.push(idee);
- }
- }
- );
- /*if (tmpDomaine || tmpCompetence) {
- ideeTmp.push(idee);
- }*/
- });
- const tmpSet = new Set(ideeTmp);
- const ideeTmpUpdate = [...tmpSet];
- return ideeTmpUpdate;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement