Code coverage report for app/components/_common/directives/loading-button.directive.js

Statements: 100% (12 / 12)      Branches: 100% (2 / 2)      Functions: 100% (3 / 3)      Lines: 100% (10 / 10)      Ignored: none     

All files » app/components/_common/directives/ » loading-button.directive.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                              
function LoadingButtonDirective () {
    return {
        restrict: 'A',
        link
    };
 
    function link (scope, element, attrs) {
        const spinner = '<i class="left mdi-notification-sync icon-rotate-animation"></i>';
        scope.$watch(attrs.aioLoadingButton, (val) => {
            if (val) {
                element.prepend(spinner);
            } else {
                // jqLite only support find by tag name
                element.find('i').remove();
            }
        });
    }
}
 
LoadingButtonDirective.$inject = [];
 
export default LoadingButtonDirective;