Topic: Spin an Icon like FontAwesome

appresearcher free asked 4 years ago


I am replacing some FontAwesome code that spins an icon for 7 seconds when a page loads... in the HTML...

<fa-icon [icon]="faMagic" fa-spin [class]=mySpinner></fa-icon>

in the TS....

  ngOnInit() {
    this.wand();
  }
async wand() {
    this.mySpinner = "toolbar-faicon-dk fa fa-spinner fa-spin";
    await this.delay(7000);
    this.mySpinner = "toolbar-faicon-dk";
  }

  public delay(ms: number) {
    return new Promise(resolve => setTimeout(resolve, ms));
  }

Is there a way to do this with your icon library?


Arkadiusz Idzikowski staff answered 4 years ago


You can use the same approach, just change the html to use mdb-icon syntax:

<mdb-icon fas [icon]="'magic'" [class]=mySpinner></mdb-icon>


appresearcher free commented 4 years ago

But since that "[class]=mySpinner" includes references to FontAwesome…

this.mySpinner = "toolbar-faicon-dk fa fa-spinner fa-spin";

If I don't install FontAwesome, it won't work, right? If I do install it, why would I need MDB? The goal is to not install FontAwesome if possible. Thanks.


Arkadiusz Idzikowski staff commented 4 years ago

Currently mdb-icon is just a wrapper for font awesome icons. We will probably add support for some other icons to this component in the future.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 8.10.0
  • Device: Surface Pro
  • Browser: FireFox
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No