Angular flickering icons

607 Views Asked by At

I implemented a simple button with Angular 11 and bootstrap and bootstrap-icons. When I route the page which shows the button the button is loaded immediately. But only when ~500ms elapsed the icon pops up and looks like flickering.

How can I get rid of this behaviour? It occurs also for icons in listviews and more.

 <button
  type="button"
  class="btn btn-secondary float-right w-25 mb-3"
 >
  <svg width="24" height="24">
    <use xlink:href="assets/bootstrap-icons/bootstrap-icons.svg#plus" />
  </svg>
  Test
</button>

enter image description here enter image description here

1

There are 1 best solutions below

0
On

You can directly install bootstrap icons into your angular project using below npm command.

npm i bootstrap-icons

Then use icons as follows. (eg: for + icon)

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">
   <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>
</svg>

This will get rid of that flickering behavior.