Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't work for $resources with isArray=true #56

Open
olimpiks opened this issue Jan 26, 2015 · 6 comments
Open

Don't work for $resources with isArray=true #56

olimpiks opened this issue Jan 26, 2015 · 6 comments

Comments

@olimpiks
Copy link

Work:

angular.module('app').factory('DemoFactory', function($resource) {
    return $resource('http://httpbin.org/delay/3', {}, {
        show : {
            method : 'GET'
        }
    })
});
angular.module('app').controller('DemoCtrl', function($scope, $http, DemoFactory) {
    $scope.demo = function() {
        $scope.promise = DemoFactory.show();
    };
});

Don't work - spinner is not shown:

angular.module('app').factory('DemoFactory', function($resource) {
    return $resource('</rest/service/request/array>', {}, {
        show : {
            method : 'GET', isArray:true
        }
    })
});
angular.module('app').controller('DemoCtrl', function($scope, $http, DemoFactory) {
    $scope.demo = function() {
        $scope.promise = DemoFactory.show();
    };
});
@ktal90
Copy link

ktal90 commented Apr 4, 2015

Make the attribute look like cg-busy="[arrayResource]" instead and it will work.

@ivaaaan
Copy link

ivaaaan commented Apr 6, 2015

Do you solve this?

I am try this:

 cg-busy="{promise:[promise].message:'Loading',backdrop:true,templateUrl:'components/angular-busy/angular-busy.html'}"

and get error:
https://docs.angularjs.org/error/$rootScope/infdig?p0=10&p1=%5B%5D

@jonagoldman
Copy link

getting same error as @ivaaaan when trying his way

@doodirock
Copy link

Same issue as above. You can do cg-busy="[arrayResource]" just fine, but if you want access to your own template and try <div cg-busy="{promise:[arrayResource],templateUrl:'template.html'}"></div> you will get a digest error

@ivaaaan
Copy link

ivaaaan commented May 27, 2015

My solution: use cg-busy="[arrayResource]" and configure your cg-busy in module:

angular.module('your_app').value('cgBusyDefaults',{
  message:'Loading Stuff',
  backdrop: false,
  templateUrl: 'my_custom_template.html',
  delay: 300,
  minDuration: 700,
  wrapperClass: 'my-class my-class2'
});

@doodirock
Copy link

Perfect @ivaaaan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants