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

Unified Diff: third_party/pkg/angular/lib/directive/ng_cloak.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_cloak.dart
diff --git a/third_party/pkg/angular/lib/directive/ng_cloak.dart b/third_party/pkg/angular/lib/directive/ng_cloak.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a661af8e5377c4c415f5cb2de7487b98fb76ddfa
--- /dev/null
+++ b/third_party/pkg/angular/lib/directive/ng_cloak.dart
@@ -0,0 +1,32 @@
+part of angular.directive;
+
+/**
+ * The `ngCloak` directive is used to prevent the Angular html template from
+ * being briefly displayed by the browser in its raw (uncompiled) form while
+ * your application is loading. Use this directive to avoid the undesirable
+ * flicker effect caused by the html template display.
+ *
+ * The directive can be applied to the `<body>` element, but typically a
+ * fine-grained application is preferred in order to benefit from progressive
+ * rendering of the browser view.
+ *
+ * `ngCloak` works in cooperation with a css. Following is the css rule:
+ *
+ * [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ * display: none !important;
+ * }
+ *
+ * When this css rule is loaded by the browser, all html elements (including
+ * their children) that are tagged with the `ng-cloak` directive are hidden.
+ * When Angular comes across this directive during the compilation of the
+ * template it deletes the `ngCloak` element attribute, which makes the compiled
+ * element visible.
+ */
+@NgDirective(selector: '[ng-cloak]')
+@NgDirective(selector: '.ng-cloak')
+class NgCloakDirective {
+ NgCloakDirective(dom.Element element) {
+ element.attributes.remove('ng-cloak');
+ element.classes.remove('ng-cloak');
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698