How can we improve Breeze.js?

Better integration with AngularJS

Ideally when working with breeze in an angular application you would not have to remember to call $apply when using async operations in breeze (eg calls to executeQuery).

I have created an angular module that monkey patches the EntityManager prototype so that the executeQuery (etc) returns a $q library promise and also calls $apply on the $rootScope. This angular module internally uses similar code to that posted here: http://www.breezejs.com/documentation/toqjs

However I've hit on a snag: code internal to breeze registers errorCallbacks using the 'fail' method on the promise object eg promise.then(callback).fail(errCallback)

The 'fail' method is not part of the CommonJS promise/A+ spec (https://github.com/promises-aplus/promises-spec), and as such is not included in the angularjs promise api.

The consequence is that the angularjs promise that the patched EntityManager.prototype returns does not have the fail method and so an exception is thrown.

Internally there are only 3 places in breeze that uses this 'fail' method to register an error callback so it seems like it would be very easy to change this code to support the CommonJS A+ spec ie: promise.then(callback, errCallback).

Thanks
Christian Crowhurst

33 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Christian CrowhurstChristian Crowhurst shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base