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

Unified Diff: third_party/pkg/angular/lib/directive/ng_show_hide.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_show_hide.dart
diff --git a/third_party/pkg/angular/lib/directive/ng_show_hide.dart b/third_party/pkg/angular/lib/directive/ng_show_hide.dart
new file mode 100644
index 0000000000000000000000000000000000000000..af9b4581e543b6b9e02c073919e1bda922a4ef01
--- /dev/null
+++ b/third_party/pkg/angular/lib/directive/ng_show_hide.dart
@@ -0,0 +1,50 @@
+part of angular.directive;
+
+/**
+ * The ngHide directive shows or hides the given HTML element based on the
+ * expression provided to the ngHide attribute. The element is shown or hidden
+ * by changing the removing or adding the ng-hide CSS class onto the element.
+ */
+@NgDirective(
+ selector: '[ng-hide]',
+ map: const {'ng-hide': '=>hide'} )
+class NgHideDirective {
+ static String NG_HIDE_CLASS = 'ng-hide';
+
+ dom.Element element;
+
+ NgHideDirective(this.element);
+
+ set hide(value) {
+ if (toBool(value)) {
+ element.classes.add(NG_HIDE_CLASS);
+ } else {
+ element.classes.remove(NG_HIDE_CLASS);
+ }
+ }
+}
+
+/**
+ * The ngShow directive shows or hides the given HTML element based on the
+ * expression provided to the ngHide attribute. The element is shown or hidden
+ * by changing the removing or adding the ng-hide CSS class onto the element.
+ */
+@NgDirective(
+ selector: '[ng-show]',
+ map: const {'ng-show': '=>show'})
+class NgShowDirective {
+ static String NG_SHOW_CLASS = 'ng-show';
+
+ dom.Element element;
+
+ NgShowDirective(this.element);
+
+ set show(value) {
+ if (toBool(value)) {
+ element.classes.add(NG_SHOW_CLASS);
+ } else {
+ element.classes.remove(NG_SHOW_CLASS);
+ }
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698