Coder Social home page Coder Social logo

ng2-fontawesome's Introduction

ng2-fontawesome

An easy-to-use directive for font awesome icons.

Install

npm i -s ng2-fontawesome

Usage

First, make sure you have a CSS and font loader set up for webpack, like so:

{
  test: /\.css/,
  loader: 'style!css'
},
{
  test: /\.woff|\.woff2|\.svg|.eot|\.ttf/,
  loader: 'file'
},

It is recommended that you globally apply the Font Awesome directive like so:

import { provide, PLATFORM_DIRECTIVES } from '@angular/core';
import { FontAwesomeDirective } from 'ng2-fontawesome';
import { bootstrap } from '@angular/platform-browser-dynamic';

bootstrap(MyAppComponent, [
  provide(PLATFORM_DIRECTIVES, { useValue: FontAwesomeDirective, multi: true })
]);

Doing so will allow you to use the fa directive anyhwere. Supposing you don't want to do that, registering it and including it like normal will work as well.

Here is how you would use it in your templates:

<i fa [icon]="'cog'" [fw]="true"></i>

Options

Name Valid Values
icon Any font awesome icon name
fw true, false
size 'lg', '2x', '3x', '4x', '5x'
spin true, false
pulse true, false
rotate '90', '180', '270'
flip 'vertical', 'horizontal'
extra any other classes you want to attach to this icon

ng2-fontawesome's People

Contributors

seiyria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ng2-fontawesome's Issues

parse fail, prob syntax err

Thanks for being so responsive to the issue you just fixed on deck.zone

but in building that project after the change I got an err for ng2-fontawesome.

Short output below. If you want it I can dump the full thing but I think it's clear:

ERROR in ./~/ng2-fontawesome/index.js
Module parse failed: C:\Users\John Vandivier\Documents\GitHub\deck.zone\node_modules\ng2-fontawesome\index.js Unexpected character '@' (5:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '@' (5:0)
at Parser.pp.raise (C:\Users\John Vandivier\Documents\GitHub\deck.zone\node_modules\acorn\dist\acorn.js:920:13)

ng2-fontawesome looks for traceur

When I install ng2-fontawesome, I get following error message on the console when I try to bootstrap

zone.js:101 GET file:///home/hayashis/git/kdinstall/traceur net::ERR_FILE_NOT_FOUND

I am compiling my .ts to .js on the server side so I don't need any transpiler installed on the client. I am not sure why ng2-fontawesome need this, but do I need to install it? If so, how?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.