| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1× 2× 1× 2× 2× 3× 1× 2× 1× | 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;
 
  |