# angular.formatter.boolean

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

## Description

Use boolean formatter if you wish to store the data as boolean.

## Usage

### In HTML Template Binding

    <input type="text" name="bindExpression" ng:format="boolean">

### In JavaScript

    var userInputString = angular.formatter.boolean.format(modelValue);
    var modelValue = angular.formatter.boolean.parse(userInputString);

### Returns

`{boolean}` –

Converts to `true` unless user enters (blank), `f`, `false`, `0`, `no`, `[]`.

## Example

       Enter truthy text:
       <input type="text" name="value" ng:format="boolean" value="no"/>
       <input type="checkbox" name="value"/>
       <pre>value={{value}}</pre>

       it('should format boolean', function(){
         expect(binding('value')).toEqual('value=false');
         input('value').enter('truthy');
         expect(binding('value')).toEqual('value=true');
       });