visurel / iconify-angular

Angular implementation of Iconify, strongly inspired from Iconify-React.
19 stars 14 forks source link

Support string syntax #9

Closed marklagendijk closed 4 years ago

marklagendijk commented 4 years ago

In the React module it supports String syntax. The idea is that an icon can be registered once with a name, and can then be used by providing that name. This is a really nice feature.

The Angular module could support this using the following solution:

Usage in template:

<ic-icon icon="homeIcon"></ic-icon>

Registerering icons:

@Component({
  selector: 'ic-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  constructor(iconService: IconService){
    iconService.addIcon('home', home);
    iconService.addIcon('groupAdd', groupAdd);
    iconService.addIcon('bellSlash', bellSlash);
  }
}
visurel commented 4 years ago

@marklagendijk Looks great and is backwards-compatible. If you can get all this into a PR we can easily get this in. 👍

marklagendijk commented 4 years ago

Awesome. I will create a pull request.

marklagendijk commented 4 years ago

I created the pull request #10