ngParty / ng-metadata

Angular 2 decorators and utils for Angular 1.x
https://hotell.gitbooks.io/ng-metadata/content/
MIT License
355 stars 46 forks source link

add zone.js for flawless integration with RxJs 5 in Angular 1 mode #85

Open Hotell opened 8 years ago

Hotell commented 8 years ago

we need to call time to time @scope.$applyAsync when using RxJS 5 and Angular 1 + ngMetadata. If we could integrate zone.js it would done that for us.

Once user will switch to hybrid mode ng1/ng2 by including ng-metadata/upgrade this would be disabled, because that Zones thingy, will be handled by Angular 2

aciccarello commented 8 years ago

Would zone.js be required or optional?

Hotell commented 8 years ago

Optional of course. Leave the users choose what they want is my motto with this one! :)

To enable it, It would look like within your main.ts

import 'zone.js';
import {enableZones} from 'ng-metadata/upgrade';

enableZones();

Or something like that

hworld commented 7 years ago

Hey, I'm curious about the effort involved. Implementing this would bring you much closer to the angular2 style API by allowing to get rid of $q completely, yeah? Async/await would be possible, then, as well. And since TS 2.1 now emits async/await for ES5, it'd be usable in most projects.

I guess it could break some apps since zone.js will always hook into events. For example, scroll events would automatically be $scope.applying? You'd have to know to pull that out of the zone, yeah?

Sorry, this may not be on the radar, but integrating zone.js into ng1 would be pretty awesome.

gitawego commented 7 years ago

this is a must feature for ng-metadata