GithubHelp home page GithubHelp logo

landru29 / angular-flash Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sachinchoolur/angular-flash

0.0 3.0 0.0 315 KB

A simple lightweight flash message module for angularjs

Home Page: http://sachinchoolur.github.io/angular-flash/

License: MIT License

JavaScript 23.46% HTML 33.79% CSS 42.75%

angular-flash's Introduction

license travis bower npm

angular-flash

A simple lightweight flash message module for angularjs.

Demo

angular-flash | jsfiddle | codepen

How to use

Bower

You can Install angular-flash using the Bower package manager.

$ bower install angular-flash-alert --save

npm

You can also find angular-flash on npm

$ npm install angular-flash-alert

Add the Following code to the <head> of your document.

<link type="text/css" rel="stylesheet" href="css/angular-flash.min.css" />
// If you are using bootstrap v3 no need to include angular-flash.css
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="angular-flash.min.js"></script>
// Do not include both angular-flash.js and angular-flash.min.js

Add flash dependency to your module

var myApp = angular.module("app", ["flash"])

Include <div flash-message="5000" ></div> directive in your html template.

<div flash-message="5000" ></div> 
<!-- 5000 milli-secs is the display duration.
     Flash alert will be automatically dismissed after 5000 milli-secs.
-->

Inject the Flash factory in your controller

myApp.controller('demoCtrl', ['Flash', function(Flash) {
    $scope.successAlert = function () {
        var message = '<strong>Well done!</strong> You successfully read this important alert message.';
        Flash.create('success', message, 'custom-class');
        // First argument (success) is the type of the flash alert
        // Second argument (message) is the message displays in the flash alert
        // you can inclide html as message (not just text)
        // Third argument (custom-class) is the custom class for the perticular flash alert
    }
}]);

####flash alert types####

  • success
  • info
  • warning
  • danger

Methods

Flash.pause();
// Pause flash auto dismiss.
Flash.dismiss()
// Dismiss the flash

MIT © Sachin

angular-flash's People

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.