aboutsummaryrefslogtreecommitdiffstats
path: root/example/widgets.html
diff options
context:
space:
mode:
authorMisko Hevery2010-02-12 19:39:01 -0800
committerMisko Hevery2010-02-12 19:39:01 -0800
commit3f9a2ab9bdfcd12cb7df74b0d38cecf2ee4ac94a (patch)
treeac3e6197c742a0771350fe8e15c8d53b85d447c3 /example/widgets.html
parent7c8a2ccb8d7b595419dfbe9151928cd2533550e3 (diff)
downloadangular.js-3f9a2ab9bdfcd12cb7df74b0d38cecf2ee4ac94a.tar.bz2
added asynchronous validator
Diffstat (limited to 'example/widgets.html')
-rw-r--r--example/widgets.html7
1 files changed, 7 insertions, 0 deletions
diff --git a/example/widgets.html b/example/widgets.html
index 1d74d243..d3e980a1 100644
--- a/example/widgets.html
+++ b/example/widgets.html
@@ -8,6 +8,11 @@
$(document).ready(function(){
angular.compile(document).init();
});
+ function asyncValidate(value, callback){
+ var x = value.length % 2 ? null: "even";
+ //callback(x);
+ _(callback).delay(1000, x);
+ }
</script>
<link rel="StyleSheet" type="text/css" href="../css/angular.css"/>
</head>
@@ -20,6 +25,8 @@
<hr/>
<input type="checkbox" name="form.boolean" ng-format="boolean" value="true" checked="checked" />
<input type="checkbox" name="form.boolean" ng-format="boolean" value="true" />
+ <hr/>
+ <input type="text" name="form.async" ng-validate="asynchronous:$window.asyncValidate" />
<pre>
form={{form}}
$invalidWidgets.length={{$invalidWidgets.length}}