Guest User

Untitled

a guest
Apr 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. search(evento){
  2. this.str = evento.target.value;
  3. console.log('str ',this.str)
  4.  
  5. this.cartoes.forEach(element => {
  6. if(element.codigo.search(this.str) !== -1 && this.cartoesFiltro.length === 0){
  7. this.cartoesFiltro.push({
  8. idtag: element.idtag,
  9. codigo: element.codigo,
  10. alocada: element.alocada,
  11. nome: element.nome
  12. })
  13. console.log('cartoesFiltro ',this.cartoesFiltro);
  14.  
  15. //this.idProcura = element.idtag;
  16. //console.log('aqui',this.idProcura);
  17. }
  18. if(element.codigo.search(this.str) !== -1 && this.cartoesFiltro.length !== 0 ){
  19. this.cartoesFiltro.forEach(dado => {
  20. if (dado.idtag === element.idtag){
  21. console.log('existe')
  22. }
  23. else{
  24. this.cartoesFiltro.push({
  25. idtag: element.idtag,
  26. codigo: element.codigo,
  27. alocada: element.alocada,
  28. nome: element.nome
  29. })
  30. }
  31. });
  32. //this.cartoesFiltro = [];
  33. //console.log('aqui ',this.cartoesFiltro)
  34. }
  35. if(element.codigo.search(this.str) === -1 && this.cartoesFiltro === 0){
  36. console.log('nachou');
  37. this.cartoesFiltro = [];
  38. }
  39. if (this.str === ''){
  40. console.log('ndeu');
  41. this.cartoesFiltro = [];
  42. console.log('cartoesFiltro ',this.cartoesFiltro);
  43.  
  44. }
  45. }
Add Comment
Please, Sign In to add comment