# angular.formatter.list

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

## Description

Use list formatter if you wish to convert the user entered string to an array.

## Usage

### In HTML Template Binding

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

### In JavaScript

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

### Returns

`{Array}` –

Array parsed from the entered string.

## Example

       Enter a list of items:
       <input type="text" name="value" ng:format="list" value=" chair ,, table"/>
       <input type="text" name="value" ng:format="list"/>
       <pre>value={{value}}</pre>

     it('should format lists', function(){
       expect(binding('value')).toEqual('value=["chair","table"]');
       this.addFutureAction('change to XYZ', function($window, $document, done){
         $document.elements('.doc-example-live :input:last').val(',,a,b,').trigger('change');
         done();
       });
       expect(binding('value')).toEqual('value=["a","b"]');
     });