Angular Loadable Content Module

Description


This module provides a series of service and directives to show/hide and inject multiple spin.js instances on each wrapper element automatically using httpInterceptor.

Installation


bower install ngloadablecontent

Usage


<script src="script/spin.js/spin.js"></script>
<script src="script/src/ngLoadableContent.js"></script>
angular.module('yourProject', ['ngLoadableContent']);
yourProject.config(['$loaderConfigProvider',function ($loaderConfigProvider) {
    $loaderConfigProvider.setDefault({color:"#0047ab", lines:20, radius:5});
}]);
<div id="whatever" ng-loadable="[loadable-id]" options="{color:'#360',radius:5,lines:8,overlay:[true/false]}">Content</div>
yourProject.controller('YourController', ['$loader', '$http', function ($loader, $http) {
    /*your methods*/
    //call the $loader service on the element you want to show
    $loader.spinElement(loadable-id, function(){ //callback });
}]);
<img id="big-image" ng-src="[source for image]" ng-loadable="[loadable-id]" options="{options}"/>
[ng-loadable]{
    position: relative;
}
.overlay {
    position: (fixed/absolute);
    z-index: 5;
    width: 100%;
    height: 100%;
    top: 0;
    right: 0;
}

Example


GRAPH (key: 1)
MANUAL (key: 2)
FORM (key: 3)
IMAGE (key: 4)

Warning, this example use ngMock End to End [ngMockE2E] to emulate AJAX requests, so you will not see any call into the network panel.

Options


More About spin.js


http://fgnass.github.io/spin.js/

this software is released under MIT license