Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

MovingImage24/gh_mi-angular-alert-service

Repository files navigation

This repository is deprecated!

The relevant repository can be found here mi-angular-alert-service

Angular Alert Service

GitHub version npm version npm downloads Build Status Coverage Status dependency Status devDependency Status License

Alert Service for AngularJS.

A customizable alert service for AngularJS apps.

Installation

Install with npm

$ npm i mi-angular-alert-service --save

Usage

Attention, the integration of bootstrap is required for the example ...

# app.js
require('angular-bootstrap');
require('mi-angular-alert-service');
var requires = [
  'ui.bootstrap',
  'mi.AlertService'
];
angular.module('sample-app', requires)
  // defaults for alert service
  .constant('ALERT_LEVELS', {
    danger: {timeout: 10000},
    warning: {timeout: 5000},
    success: {timeout: 3000},
    info: {timeout: 3000}
  })
;
angular.bootstrap(document, ['sample-app']);
# index.html
<div class="global-alerts" ng-cloak>
    <div alert ng-repeat="alert in alerts" type="{{alert.type}}" close="alert.close()">{{alert.msg}}</div>
</div>

Tests

Trigger unit test with npm

$ npm run test

Travis and npmjs

Every push will trigger a test run at travis-ci (node.js-versions: 0.10, 0.12, 4.0, 4.1, 4.2 and 4.3). In case of a tagged version and success (node.js 4.3) an automated pbulish to npmjs.org will be triggered by travis-ci.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This library is under the MIT license.