Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import {Pipe, PipeTransform} from '@angular/core';
  2. import {Idee} from '../Idee';
  3.  
  4. @Pipe({
  5. name: 'ideaFilter'
  6. })
  7. export class IdeaFilterPipe implements PipeTransform {
  8.  
  9. transform(idees: Idee[], text: string): Idee[] {
  10. let ideeTmp: Idee[] = [];
  11. if (text == null || text === '') {
  12. return idees;
  13. }
  14. idees.forEach(idee => {
  15. idee.domaines.forEach(
  16. domaine => {
  17. if (domaine.libelle === text) {
  18. // console.log(JSON.stringify(idee));
  19. ideeTmp.push(idee);
  20. }
  21. }
  22. );
  23. idee.comptences.forEach(
  24. competence => {
  25. if (competence.libelle === text) {
  26. // console.log(JSON.stringify(idee));
  27. ideeTmp.push(idee);
  28. }
  29. }
  30. );
  31. /*if (tmpDomaine || tmpCompetence) {
  32. ideeTmp.push(idee);
  33. }*/
  34. });
  35. const tmpSet = new Set(ideeTmp);
  36. const ideeTmpUpdate = [...tmpSet];
  37. return ideeTmpUpdate;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement