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

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

Issue 148453003: Updating Angular version (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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_src_boolean.dart
diff --git a/third_party/pkg/angular/lib/directive/ng_src_boolean.dart b/third_party/pkg/angular/lib/directive/ng_src_boolean.dart
index 340a1914a4799c01d4c80657edb35c4cb7dcdb52..5511c91d955813453dd17d19571787627a6d8492 100644
--- a/third_party/pkg/angular/lib/directive/ng_src_boolean.dart
+++ b/third_party/pkg/angular/lib/directive/ng_src_boolean.dart
@@ -73,3 +73,32 @@ class NgSourceDirective {
set srcset(value) => attrs['srcset'] = value;
}
+
+/**
+ * In SVG some attributes have a specific syntax. Placing `{{interpolation}}` in those
+ * attributes will break the attribute syntax, and browser will clear the attribute.
+ *
+ * The `ng-attr-*` is a generic way to use interpolation without breaking the attribute
+ * syntax validator. The `ng-attr-` part get stripped.
+ *
+ * @example
+ <svg>
+ <circle ng-attr-cx="{{cx}}"></circle>
+ </svg>
+ */
+@NgDirective(selector: '[ng-attr-*]')
+class NgAttributeDirective implements NgAttachAware {
+ NodeAttrs _attrs;
+
+ NgAttributeDirective(NodeAttrs this._attrs);
+
+ void attach() {
+ _attrs.forEach((key, value) {
+ if (key.startsWith('ngAttr')) {
+ String newKey = snakecase(key.substring(6));
+ _attrs[newKey] = value;
+ _attrs.observe(snakecase(key), (newValue) => _attrs[newKey] = newValue );
+ }
+ });
+ }
+}
« no previous file with comments | « third_party/pkg/angular/lib/directive/ng_pluralize.dart ('k') | third_party/pkg/angular/lib/directive/ng_style.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698