Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/pkg/angular/lib/directive/ng_events.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « third_party/pkg/angular/lib/directive/ng_control.dart ('k') | third_party/pkg/angular/lib/directive/ng_form.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698