angular.widget.@ng:validate

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

Description

The ng:validate attribute widget validates the user input. If the input does not pass validation, the ng-validation-error CSS class and the ng:error attribute are set on the input element. Check out validators to find out more.

Usage

In HTML Template Binding

<INPUT ng:validate="validator">
   ...
</INPUT>

Parameters

Example

I don't validate: <input type="text" name="value" value="NotANumber"><br/> I need an integer or nothing: <input type="text" name="value" ng:validate="integer"><br/> it('should check ng:validate', function(){ expect(element('.doc-example-live :input:last').attr('className')). toMatch(/ng-validation-error/); input('value').enter('123'); expect(element('.doc-example-live :input:last').attr('className')). not().toMatch(/ng-validation-error/); });