@zupit-it/ng-fantasticon
v0.1.4
Published
This library provides a helper component for the [@zupit-it/fantasticon](https://www.npmjs.com/package/@zupit-it/fantasticon) package. It allows you to easily use the icons generated by `zupit-fantasticon` in your Angular application.
Downloads
3
Readme
ng-fantasticon
This library provides a helper component for the @zupit-it/fantasticon package. It allows you to easily use the icons generated by zupit-fantasticon
in your Angular application.
Prerequisites
Install @zupit-it/fantasticon and follow the Angular setup instructions.
Usage
You can use the NgFantasticonComponent
to display the icons in your Angular application.
First you will need to import the NgFantasticonModule
and to provide your Icons
enum generated by zupit-fantasticon
via the forRoot()
function:
app.module.ts
:
import { Icons } from '../path-to-your-icons-enum'
import { NgFantasticonModule } from '@zupit-it/ng-fantasticon'
@NgModule({
imports: [NgFantasticonModule.forRoot(Icons)]
})
export class AppModule {}
Then you can use the ng-fantasticon
component in your templates:
<ng-fantasticon [icon]="Icons.MyIcon"></ng-fantasticon>
If you don't provide a valid icon (i.e. an icon that is not in the enum), the component will not be displayed and an error will be thrown in the console.