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

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

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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_bind.dart
diff --git a/third_party/pkg/angular/lib/directive/ng_bind.dart b/third_party/pkg/angular/lib/directive/ng_bind.dart
new file mode 100644
index 0000000000000000000000000000000000000000..19335a854e20101b273669e93c7ad307fdfdb7b7
--- /dev/null
+++ b/third_party/pkg/angular/lib/directive/ng_bind.dart
@@ -0,0 +1,27 @@
+part of angular.directive;
+
+/**
+ * The ngBind attribute tells Angular to replace the text content of the
+ * specified HTML element with the value of a given expression, and to update
+ * the text content when the value of that expression changes.
+ *
+ * Typically, you don't use ngBind directly, but instead you use the double
+ * curly markup like {{ expression }} which is similar but less verbose.
+ *
+ * It is preferrable to use ngBind instead of {{ expression }} when a template
+ * is momentarily displayed by the browser in its raw state before Angular
+ * compiles it. Since ngBind is an element attribute, it makes the bindings
+ * invisible to the user while the page is loading.
+ *
+ * An alternative solution to this problem would be using the ngCloak directive.
+ */
+@NgDirective(
+ selector: '[ng-bind]',
+ map: const {'ng-bind': '=>value'})
+class NgBindDirective {
+ dom.Element element;
+
+ NgBindDirective(this.element);
+
+ set value(value) => element.text = value == null ? '' : value.toString();
+}

Powered by Google App Engine
This is Rietveld 408576698