| Index: third_party/pkg/angular/lib/directive/ng_events.dart
|
| ===================================================================
|
| --- third_party/pkg/angular/lib/directive/ng_events.dart (revision 33054)
|
| +++ third_party/pkg/angular/lib/directive/ng_events.dart (working copy)
|
| @@ -25,6 +25,7 @@
|
| *
|
| * The full list of supported handlers are:
|
| *
|
| + * - [ng-blur]
|
| * - [ng-abort]
|
| * - [ng-beforecopy]
|
| * - [ng-beforecut]
|
| @@ -130,15 +131,7 @@
|
| @NgDirective(selector: '[ng-transitionend]', map: const {'ng-transitionend': '&onTransitionEnd'})
|
|
|
| class NgEventDirective {
|
| - // Is it better to use a map of listeners or have 29 properties on this
|
| - // object? One would pretty much only assign to one or two of those
|
| - // properties. I'm opting for the map since it's less boilerplate code.
|
| - var listeners = {};
|
| - final dom.Element element;
|
| - final Scope scope;
|
|
|
| - NgEventDirective(this.element, this.scope);
|
| -
|
| // NOTE: Do not use the element.on['some_event'].listen(...) syntax. Doing so
|
| // has two downsides:
|
| // - it loses the event typing
|
| @@ -151,7 +144,9 @@
|
| int key = stream.hashCode;
|
| if (!listeners.containsKey(key)) {
|
| listeners[key] = handler;
|
| - stream.listen((event) => handler({r"$event": event}));
|
| + stream.listen((event) => scope.$apply(() {
|
| + handler({r"$event": event});
|
| + }));
|
| }
|
| }
|
|
|
| @@ -206,4 +201,13 @@
|
| set onTouchMove(value) => initListener(element.onTouchMove, value);
|
| set onTouchStart(value) => initListener(element.onTouchStart, value);
|
| set onTransitionEnd(value) => initListener(element.onTransitionEnd, value);
|
| +
|
| + // Is it better to use a map of listeners or have 29 properties on this
|
| + // object? One would pretty much only assign to one or two of those
|
| + // properties. I'm opting for the map since it's less boilerplate code.
|
| + var listeners = {};
|
| + dom.Element element;
|
| + Scope scope;
|
| +
|
| + NgEventDirective(this.element, this.scope);
|
| }
|
|
|