climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1489255 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js
Date Tue, 04 Jun 2013 00:30:00 GMT
Author: joyce
Date: Tue Jun  4 00:29:59 2013
New Revision: 1489255

URL: http://svn.apache.org/r1489255
Log:
Resolves CLIMATE-74 - Adds on-blur directive.

- Adds the on-blur directive. The function that is passed with the
  on-blur attribute will be called under the enclosing scope when the
  tags blur event triggers.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js?rev=1489255&r1=1489254&r2=1489255&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js Tue Jun  4 00:29:59 2013
@@ -371,4 +371,21 @@ directive('predictiveFileBrowserInput', 
 		scope: true,
 		restrict: 'A'
 	};
-});
+}).
+// The onBlur directive calls a passed function when a field's "blur" event is called.
+// The function should be passed as part of the "on-blur" attribute and be defined in
+// the containing scope.
+//
+// Consider the test function "testFunc". If you wanted this to run on the blur event
+// for an input box you would use the following:
+//   <input type="text" on-blur="testFunc();" />
+directive('onBlur', function() {
+	return {
+        restrict: 'A',
+        link: function($scope, $elem, $attrs) {
+            $elem.bind('blur', function() {
+				$scope.$eval($attrs.onBlur);
+			});
+        },
+    };
+ });



Mime
View raw message