The ng:format
attribute widget formats stored data to user-readable text and parses the text
back to the stored form. You might find this useful, for example, if you collect user input in a
text field but need to store the data in the model as a list. Check out
formatters
to learn more.
<INPUT ng:format="formatter"> ... </INPUT>
formatter – {string} –
The name of the built-in or custom formatter
to be used.
This example shows how the user input is converted from a string and internally represented as an array.
Enter a comma separated list of items: <input type="text" name="list" ng:format="list" value="table, chairs, plate"> <pre>list={{list}}</pre>
it('should check ng:format', function(){ expect(binding('list')).toBe('list=["table","chairs","plate"]'); input('list').enter(',,, a ,,,'); expect(binding('list')).toBe('list=["a"]'); });