jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 269 forks source link

AngularJS 2.0 HTTP does not update bindings unless the response logic is... #175

Open kelf opened 8 years ago

kelf commented 8 years ago

With ng2 xdomain properly intercepts HTTP requests. Unfortunately, it pulls any HTTP callback logic outside of the Angular "zone".

This is not necessarily a bug, but it is inconvenient, and very confusing at first. A good solution would be to provide an opportunity to inject a callback at xdomain config time, which would wrap the request's success callback.

Using this, an end-user can configure xdomain to automatically instantiate and wrap the logic in a zone.run(...).

jpillora commented 8 years ago

I'm not very familiar with angular 2.0 zones. I vague understand it to be wrapping all JS runtime async functions (setTimeout, setInterval, XMLHttpRequest, etc). This is an XHook issue so I've recreated it there, not sure when I'll get to time to debug this though... Locked, please continue discussion here https://github.com/jpillora/xhook/issues/40