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

228
Visualizações
Render icons from an SVG file on HTML page

I have an icons.svg file that seems to contain assets that I need to use in my Angular app.

The file looks something like this (note, the ... means omitted data due to security reasons):

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs>
<path d="..." id="o"/></defs>
<symbol id="icon-add-member-contain-heavy" viewBox="0 0 64 64">
<path d="B0 ... 4A3q"/>
</symbol>
<symbol id="icon-add-member-contain-light" viewBox="0 0 64 64">
<path d="A5 ... 2i5m"

...
...
.../></symbol></svg>

I am trying to reference the file in my component HTML (as shown in the code below), but I don't know how to render an icon. I am guessing I need to use the id's that are shown in the above svg code, like id="icon-add-member-contain-heavy"?

    <div>
      <img src="../../src/assets/icons.svg">
    </div>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In angular, you should be able to render the svg as a component. From the angular docs:

import { Component } from '@angular/core';

@Component({
  selector: 'app-svg',
  templateUrl: './svg.component.svg',
  styleUrls: ['./svg.component.css']
})
export class SvgComponent {
  fillColor = 'rgb(255, 0, 0)';

  changeColor() {
    const r = Math.floor(Math.random() * 256);
    const g = Math.floor(Math.random() * 256);
    const b = Math.floor(Math.random() * 256);
    this.fillColor = `rgb(${r}, ${g}, ${b})`;
  }
}
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