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

255
Visualizações
How to use angular pipes in window.open with url?
<div class="member-img" onclick="window.open(childEpisode.File_URL | fullPath)">
</div>

the fullPath is a pipe that concatenates the domain part to the URL i.e. file_URL which is relative.

but it doesn't work and shows nothing.

If I use it with img enter code herethen it works but i want it the way I have posted above.

working example:

 <img [src]="childEpisode.File_URL | fullPath" [alt]="childEpisode.Name_AR" class="member-thumnail img-fluid">
about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

you can implement it like this:

<div class="member-img" (click)="openMyLink(childEpisode.File_URL | fullPath)">

then in YourComponent.ts file implement the method like this:

openMyLink(link:string){
  window.open(link)
}
about 4 years ago · Santiago Trujillo Relatório

0

Solution:

In html template use Angular Event binding:

<div class="member-img" (click)="openURL(childEpisode.File_URL)">...</div>

In the Component ts file inject the FullPathPipe class and use it's transform method:

constructor(private fullPathPipe: FullPathPipe) {...}

openURL(url: string) {
  const transformedURL = this.fullPathPipe.transform(url);
  window.open(transformedURL);
}

Note:

  • The pipe operator is not allowed within Template statements. https://angular.io/guide/template-statements#syntax
  • Template statements cannot refer to anything in the global namespace such as window or document. https://angular.io/guide/template-statements#statement-best-practices
about 4 years ago · Santiago Trujillo 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