cgross / angular-busy

Show busy/loading indicators on any element during $http requests (or any promise).
http://cgross.github.io/angular-busy/demo
MIT License
1.44k stars 256 forks source link

Not working in directives #61

Open ivaaaan opened 9 years ago

ivaaaan commented 9 years ago
search.factory('Search', function($resource) {
    return {

        search: $resource('/api/search/?text=:text&sorted=:sorted', {}, {
            get: {
                method: "GET",
                isArray: true
            }
        })
    }

});

In template:

cg-busy="[promise]"

Directive:

search.directive('sort', [
    function () {
        return {
            restrict: 'A',
            link: function($scope, element, attrs) {
                element.bind('click', function() {
                    $scope.sorted = attrs.type;
                    $scope.searchTracks();
                });
            }
        }
    }
]);

If I call the search of the template - it works, but if the directive - no

henriquecholo commented 9 years ago

+1