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

Angular 1.5.5 + zone.js #14548

Closed
char0n opened this issue May 1, 2016 · 1 comment
Closed

Angular 1.5.5 + zone.js #14548

char0n opened this issue May 1, 2016 · 1 comment

Comments

@char0n
Copy link

char0n commented May 1, 2016

Note: for support questions, please use one of these channels: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.

Do you want to request a feature or report a bug?

I would suggest this this is bug. Running hybrid application using angular1 and angular2 should be possible according to the documentation. One of the requirements of angular2 applications is zone.js (https://github.com/angular/zone.js).

What is the current behavior?

zone.js patches the window.setTimeout and window.setInterval functions (all other async apis are also patched). These functions no longer returns unique integers to track the timers, but instead they return the ZoneTask objects. ZoneTask doesn't have toString() method implemented so all the pending deferreds ends up in Browser.pendingDeferIds under property name '[object Object]'. This effectively takes the opportunity to cancel the deferreds.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

var p1 = $timeout(() => {});
var p2 = $timeout(() => {});

$timeout.cancel(p1);  // This cancels the second not the first timeout

The same behavior can be seen on $interval service.

What is the expected behavior?

var p1 = $timeout(() => {});
var p2 = $timeout(() => {});

$timeout.cancel(p1);  // This cancells p1 only.

What is the motivation / use case for changing the behavior?

The be able to run angular1 <-> angular2 hybrid application and to migrate angular1 codebase progressively to angular2.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

angular=1.5.5
angular2=2.0.0-beta.17
zone.js=0.6.12

Other information (e.g. stacktraces, related issues, suggestions how to fix)

@char0n char0n changed the title Angular 1.5 + zone.js Angular 1.5.5 + zone.js May 1, 2016
@lgalfaso
Copy link
Contributor

lgalfaso commented May 1, 2016

The behavior of `setTimeout should not change when using Zones, with this in mind, please open an issue in their repository https://github.com/angular/zone.js

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

No branches or pull requests

2 participants