Code Monkey home page Code Monkey logo

angular-css-injector's Introduction

===== Warning : Angular 1.3

The code is compatible with angular 1.2.x but not with 1.3 yet. Check #23. PR appreciated.

Angular-css-injector

A angularJS service to load dynamically CSS files. The original name of this project was angularDynamicStylesheets.

===== Description

angular-css-injector is a AngularJS service allows you to load dynamically CSS files in your HTML page.

==== How to use ?

  1. Your angular's app must be defined on the HTML tag of your page
<html ng-app="myApp"
  1. Add the module "angular.css.injector" to your AngularJS apps
     angular.module('myApp', ['angular.css.injector']);
  1. Get this service where you want and add your css files in your HTML page ! Example here in a controller :
     function MyCtrl($scope, cssInjector)
     {
         cssInjector.add("/path/to/your/css/file.css");
     }
  1. To remove all added CSS files when the page change (in a single page application), configure the cssInjectorProvider:
	 myApp.config(function(cssInjectorProvider){
	 	 cssInjectorProvider.setSinglePageMode(true);
	 });
  1. To remove manually all added CSS files, call the function removeAll :
     function MyCtrl($scope, cssInjector)
     {
         cssInjector.removeAll();
     }

==== Compatibility

IE >= 8

FF >= 3.5

Chrome >= 4

Opera >= 10

==== Dependencies

No one (only angular of course).

Code tested with angular 1.2.14

==== Previous version

The module and the service name changed name from v1.0 Be careful and update your code if you use a previous version < 1.0

angular-css-injector's People

Contributors

ebrentnelson avatar lifter035 avatar timelf123 avatar trestoa avatar

Watchers

 avatar  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.