0.1.0 • Published 7 years ago

ngarise v0.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

ngArise

Build Status GitHub release

Demo

Visit the Github page for a demo

Installing

Download directly

Download ngArise files from GitHub

Yarn

yarn add ngArise --save

NPM

npm install ngArise --save

Bower

bower install ngArise --save

How to Use

Add the dependency ngArise

angular.module('app', ['ngArise']);

Add provider to make configurations (optional)

.config(['ariseProvider', function (ariseProvider) {
    ariseProvider.setOptions(
        {
            title: 'Custom title',
            message: 'Here a message',
            templateUrl: 'path/to/views/message.html'
        }
    );
    
    ariseProvider.setDebug(true); // default is false
}]);

Inject Arise service to show / hide or destroy

.controller(['Arise', function(Arise) {
    Arise.show();
    // and / or
    Arise.hide();
    // and / or
    Arise.destroy();
}]);

Note: Arise.destroy() will remove all the Arises (put count on 0 and loading false) since multiple Arises can occur

Place directive in html as element or attribute

<ng-arise></ng-arise>
<!-- or -->
<div ng-arise></div>

Provider API

Options can be passed to configuration provider globally

The options list:

OptionTypeDefault valueDescription
titleString"Please wait"Message that is shown as H2 in default template
messageString"We're loading data"String that is shown as a paragraph in default template
templateUrlString"views/default.html"Specify which template should be loaded

Factory API

Calling the factory Arise to show or hide the loading box an option object can be passed to it.

.controller(['Arise', function(Arise) {
    Arise.show({
        title: 'Changed title on the fly',
        message: 'Message can be changed too'
    });
    // and / or
    Arise.hide();
}]);

The functions list:

OptionTypeParameter
showfunctionObjecttitle, message
hidefunction
changefunctionObjecttitle, message
destroyfunction

Note: Arise.hide() will reset the values to the standard provided provider settings

The options list:

OptionTypeOptionalDescription
titleStringtrueMessage that is shown as H2 in default template
messageStringtrueString that is shown as a paragraph in default template