Coder Social home page Coder Social logo

Comments (6)

stephanie-dm avatar stephanie-dm commented on June 6, 2024 1

I've investigated this problem a little further and I've come to a different conclusion:
the problem I'm seeing occurs everywhere I use an Angular resource as a promise for cgBusy.

In my controller I have the following code:
$scope.dossiers = Dossier.query();

In my HTML, I do this:
<div cg-busy="[dossiers]">

This worked fine in angular-busy 4.1.0, but not anymore in 4.1.1 (then it causes the error "cgBusy expects a promise (or something that has a .promise or .$promise ")
But when I change the HTML to this:
<div cg-busy="[dossiers.$promise]">

Then the busy-indicator works again in version 4.1.1 and Angular 1.2.26

Sorry I didn't provide a Plunkr, but I'm afraid I don't have the time for it at the moment. I hope I gave you enough information.

from angular-busy.

cgross avatar cgross commented on June 6, 2024

I've tried but I can't reproduce this problem. With angular 1.2.26 and setting the promise to null or undefined - I cannot reproduce the error you're seeing.

Perhaps you can investigate more on your end or provide a reproducible example using plnkr or similar service.

from angular-busy.

henriquecholo avatar henriquecholo commented on June 6, 2024

I have the same issue of stephanie-dm..... i'm using Angular 1.3.1 and and Angular-busy 4.1.1

Just one thing, to make it work i just used Angular 1.2.26 and Angular-busy 4.1.0... Changed on bower worked for now, but I'm still waiting for a fix.

from angular-busy.

mckinleymedia avatar mckinleymedia commented on June 6, 2024

I had the same issue. I solved it with a simple ng-init:
<div cg-busy="{promise:promise,message:message,templateUrl:'a-busy.html'}" ng-init="promise = $promise">

from angular-busy.

mckinleymedia avatar mckinleymedia commented on June 6, 2024

Update - when I do a subsequent full refresh of the page, the ng-init method fails. It worked for many conditions. To solve it, I had to hack the angular-busy.js "addPromiseLikeThing" function as follows:
var addPromiseLikeThing = function(promise){
var then = tracker.getThen(promise);

        if (!then) {
            // throw new Error('cgBusy expects a promise (or something that has a .promise or .$promise');
        }
        if (then) {
                if (tracker.promises.indexOf(promise) !== -1){
                    return;
                }
                tracker.promises.push(promise);
                then(function(){
                    promise.$cgBusyFulfilled = true;
                    if (tracker.promises.indexOf(promise) === -1) {
                        return;
                    }
                    tracker.promises.splice(tracker.promises.indexOf(promise),1);
                },function(){
                    promise.$cgBusyFulfilled = true;
                    if (tracker.promises.indexOf(promise) === -1) {
                        return;
                    }
                    tracker.promises.splice(tracker.promises.indexOf(promise),1);
                });
        }
    };

Removed the error and encased the promise-processor in an if statement.

from angular-busy.

stephanie-dm avatar stephanie-dm commented on June 6, 2024

I have upgraded to 4.1.3 and I can't reproduce this issue anymore.
The following code works again if "dossiers" is the result of a resource-call that returns an array:
<div cg-busy="[dossiers]">

from angular-busy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.