FormlyTransformer
Better way of field transformation in Angular-Formly.
Install
meteor
meteor add wieldo:angular-formly-transformer
npm
npm install angular-formly-transformer
bower
bower install angular-formly-transformer
Getting Started
angular
formlyTransformer service
How to use it
Register transformer
Each transformer has four arguments: fields, model, formOptions, and form.
See fieldTransform in formlyConfig for details.
Transformer is basically the same as fieldTransform method. formlyTransform service just wraps all functions into one place.
formlyTransformer;
Special space in formly field configuration (formlyconfig)
formlyTransformer creates property with "transformers" key and empty object as value.
Special space is removed after all the transformers are executed.
So basically, you can put there all your transformation methods which are based on custom property.
Example
angular ; { // label upperCaseLabel transformer formlyTransformer; } { var vm = this; vmfields = key: 'firstName' type: 'input' templateOptions: label: 'First name' transformers: upperCaseLabel: true ; console; // FIRST NAME }