http://angularjs.org/Validator
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 8 Nov 2010 18:39:44 +0000 (19:39 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 8 Nov 2010 18:39:44 +0000 (19:39 +0100)
templates/Cookbook/3-Validator.html.ep [new file with mode: 0644]

diff --git a/templates/Cookbook/3-Validator.html.ep b/templates/Cookbook/3-Validator.html.ep
new file mode 100644 (file)
index 0000000..a607d47
--- /dev/null
@@ -0,0 +1,9 @@
+<script>
+  angular.validator.upsTrackingNo = function(input, format) {
+    var regexp = new RegExp("^" + format.replace(/9/g, '\\d') + "$");
+    return input.match(regexp)?"":"The format must match " + format;
+  };
+</script>
+<input type="text" name="trackNo" size="40"
+       ng:validate="upsTrackingNo:'1Z 999 999 99 9999 999 9'" 
+       value="1Z 123 456 78 9012 345 6"/>