Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
How to skip print and not show item if not true ? Vanilla JS/TS and angular 9

I have a problem that if my value is number I skip that interaction and don't print it

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

In ts

sanitize(val){
  return val.split('/').pop().replace(/-/g, " "); 
}

get bookLinks() {
 return this.book.links
 .map(item=> ({...item,  href:this.sanitize(item.href)}))
 .filter(item=> !this.isNumeric(item.href));
}

In template

<button type="button" 
      *ngFor="let singleBook of bookLinks">  
       <span (click)="showI(book, $event, i)" >
          {{ singleBook.href }} 
       </span>
   </button>
about 4 years ago · Juan Pablo Isaza Relatório

0

Iterate over desired items. It means do not use book.links in ngFor but use your own derived array, without empty items.

Eg

<button *ngFor="let singleBook of validLinks" type="button">  
  ...
</button>

And use eg getter on component

get validLinks () {
  return this.book.links.filter(b => !!b.trim())
}
about 4 years ago · Juan Pablo Isaza Relatório

0

As you cannot use several structure/conditional instructions on same element (ngif + ngfor), you might fix the issue by using a ng-container wrapper.

<ng-container *ngFor="let singleBook of book.links">
  <button type="button" *ngIf="selectedAction(singleBook.href)">
   <span (click)="showI(book, $event, i)">
      {{ selectedAction(singleBook.href) }} 
   </span>
  </button>
</ng-container>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda