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

178
Visualizações
Angular - opening a modal causes" Content Security Policy (script-src 'self') Error"

I am working on an Angular project and I am running into an issue where clicking a link to open a modal causes the following error:

Refused to run /cards:1 the JavaScript URL because it violates the following Content Security Policy directive: "Script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-....'), or a none ('nonce-...') is required to enable inline execution.

I am confused by this error because there are multiple other locations in the code where clicking a button/dropdown/etc causes a modal to open, but it does not throw the same error. I also imagine the script is coming from the application itself. Could the 'a' tag be the problem? Also the mentioning of "/cards:1" is interesting because that is not the component itself, but the parent component.

The code with the link/modal:

<error-badge>
   <error-item>
     <span>{{ text }}</span>
     <div>
        <a href="javascript:void(0)" (click)="openModal()">
          {{ linkText }}}
        </a>
     </div>
   </error-item>
</error-badge>

<modal [(modalOpen)]="modalOpen">
   {{ modalText }}}
</modal>
about 4 years ago · Juan Pablo Isaza
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