ng-svg-icon
v1.0.2
Published
* GITHUB : https://github.com/guptasanchit90/ng-svg-icon
Downloads
4
Readme
ng-svg-icon
GITHUB : https://github.com/guptasanchit90/ng-svg-icon
NPM : https://www.npmjs.com/package/ng-svg-icon
Demo : https://guptasanchit90.github.io/ng-svg-icon/
Status
Installation
To install this library, run:
$ npm install ng-svg-icon --save
Consuming your library
Once you have published your library to npm, you can import your library in any Angular application by running:
$ npm install ng-svg-icon
and then from your Angular AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import your library
import { NgSvgIconModule } from 'ng-svg-icon';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgSvgIconModule.forRoot({})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
// To pass default config while importing
NgSvgIconModule.forRoot({
defaultColor: '#000',
defaultSize: 50,
defaultViewBox: '0 0 24 24'
})
Once library is imported, you can use its components in your Angular application:
<!-- Pass custom config to each icon -->
<ng-svg-icon name="help" color="white" size="24" viewBox="0 0 24 24"></ng-svg-icon>
<!-- Pass dynamic icon name -->
<ng-svg-icon [name]="iconName"></ng-svg-icon>
License
MIT © Sanchit Gupta