Search code examples
angularanimationprogress-barngx-bootstrap

Animate ngx-bootstrap progressbar


The dynamic value progressbar example has an animation where the colored bar value fills up.

Is it possible to have that animation effect (filling up the bar), with a static value?

I tried adding [animate]="false" and that did not work.

The progressbar seems to load at the value.

https://valor-software.com/ngx-bootstrap/#/progressbar#bs3-dynamic


Solution

  • This works, but feels like a hack :)

    //Component:
    value: number = 0;
    ngOnInit() {
       setTimeout(() => this.value = 20, 0)
    }
    
    //Template:
    <progressbar [value]="value"></progressbar>
    

    And do not use [animate]="false", it won't animate if you use it.