Giter VIP home page Giter VIP logo

angular2-fontawesome's Introduction

Angular2 Fontawesome (Beta) Circle CI

Angular2 components for Fontawesome

Note: Do Not Use in Production. Some behaviors would be modified in the future release. This is because Angular2 is currently beta release, and it seems to be batter to wait for some features (like this) and best practices.

Installation

In package.json, insert a following line in the dependencies:

"angular2-fontawesome": ">=0.1.0"

We can import this library with SystemJS:

// This example is following to Angular2 Quick Start Documentation
// Reference: https://angular.io/docs/ts/latest/quickstart.html

System.config({
    packages: {
        app: {
            format: 'register',
            defaultExtension: 'js'
        },
        // add this line (1)
        "angular2-fontawesome": {"defaultExtension": 'js'}
    },
    map: {
      // add this line (2)
      'angular2-fontawesome': 'node_modules/angular2-fontawesome/lib'
    }
});

System.import('app/main').then(null, console.error.bind(console));

Note: This might be modified to eliminate above configuration lines, and can be used by just import .. from .. statement in each module.

Usage

  1. Add Fontawesome to your application.

  2. In the decorators, use directives (Angular2 Quickstart for example):

import {FaComponent} from 'angular2-fontawesome/components';

@Component({
  selector: 'my-app',
  template: '<fa [name]="\'rocket\'" [border]=true></fa>',
  directives: [FaComponent],
})
export class AppComponent {}

Parameters

<fa [name]=string      // name of fontawesome icon
    [size]=number      // [1-5]
    [flip]=string      // [horizontal|vertical]
    [pull]=string      // [right|left]
    [rotate]=number    // [90|180|270]
    [border]=boolean   // [true|false]
    [spin]=boolean     // [true|false]
    [fw]=boolean       // [true|false]
    [inverse]=boolean  // [true|false]
    ></fa>

name

<fa [name]="'rocket'"></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket"></i>
</fa>
<!-- or simply, -->
<fa name="rocket"></fa>
<!-- rendered -->
<fa name="rocker">
  <i class="fa fa-rocket"></i>
</fa>

size

<fa [name]="'rocket'" [size]=1></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-lg"></i>
</fa>

flip

<fa [name]="'rocket'" [flip]="'horizontal'"></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-flip-horizontal"></i>
</fa>

pull

<fa [name]="'rocket'" [pull]="'right'"></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-pull-right"></i>
</fa>

rotate

<fa [name]="'rocket'" [rotate]=90></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-rotate-90"></i>
</fa>

border

<fa [name]="'rocket'" [border]=true></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-border"></i>
</fa>

spin

<fa [name]="'rocket'" [span]=true></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-span"></i>
</fa>

fw

<fa [name]="'rocket'" [fw]=true></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-fw"></i>
</fa>

inverse

<fa [name]="'rocket'" [inverse]=true></fa>
<!-- rendered -->
<fa>
  <i class="fa fa-rocket fa-inverse"></i>
</fa>

TODO

  • Remove <fa> from rendered results
  • Support for fa-stack
  • Support for fa-li and fa-ul
  • Test codes
    • After the Angular2 guideline for test code is published

License

(MIT License) - Copyright (c) 2016 Komei Shimamura

angular2-fontawesome's People

Contributors

travelist avatar mattvonvielen avatar

Watchers

Avid Coder avatar James Cloos avatar  avatar

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.