Giter Site home page Giter Site logo

angular-inline-svg's Introduction

AngularJS inline-svg component Build Status

  • Include svg sprites one time at the top of the document.
  • Use inline svg symbol using <use>.
  • It is also possible to use angular binding, translations, directives, etc. in the svg sprite!

Requirements

  • AngularJS

Usage

bower for dependency management. Install and save to bower.json by running:

$ bower install angular-inline-svg --save

Add the module to your application:

<script src="bower_components/angular-inline-svg/dist/ngInlineSvg.min.js"></script>
var myAppModule = angular.module('MyApp', ['inline-svg']);

Create a symbol sprite (e.g. mySvgSymbols.html) that looks like:

<svg xmlns="http://www.w3.org/2000/svg">
  <g id="myCircle">
     // circle drawing
  </g>
  <g id="myRectange">
     // rectange drawing
  </g>
  <g id="myLogo">
     // logo drawing
  </g>
</svg>

Include the directive in your html:

<inline-svg-symbol sprite="mySvgSymbols.html" symbol="'#myCircle'"/>
<inline-svg-symbol sprite="mySvgSymbols.html" symbol="'#myRectange'"/>
<inline-svg-symbol sprite="mySvgSymbols.html" symbol="'#myLogo'"/>

Contribute

Prepare your environment:

  • Install Node.js and npm.
  • Install global dev dependencies: npm install -g bower gulp
  • Install local dev dependencies: npm install && bower install in repository directory

Development commands:

  • npm run build - to clean, jshint, build and test
  • npm run serve - to watch src files to jshint, build and test when changed

When issuing a pull request, please exclude changes from the "dist" folder to avoid merge conflicts.

angular-inline-svg's People

Contributors

alonn24 avatar

Watchers

 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.