Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Expose qFactory to enable a custom $q with a $scope-independent nextTick() #2993

Closed
@mgcrea

Description

@mgcrea

I'm having a hard time solving $q promises not correctly resolving out of AngularJS, in my case bridging back from Cordova/PhoneGap in a service.

  • Using the $rootScope.$apply won't work, I hit the $digest already in progress as I need several stacked calls when the app boot up (GoogleAnalytics init, PushNotifications, Udid retrieval, etc.). (actual code: https://github.com/mgcrea/angular-cordova/blob/master/src/angular-cordova.js#L37)
  • $rootScope.$evalAsync won't work, promise is never resolved.
  • Using $timeout works but is clearly suboptimal as it slows the bridge & triggers useless repaints.

It looks like several people encountered the same "broken promises" issue. Thus the idea of being able to define a custom $q that would behave more like the real $q for out of scope (usually in-services) operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions