This Ember-cli addon provides a set of ready-to-use pipes and masks that can be used with Ember-text-mask.
-
Masks
numberMaskemailMask
-
Pipes
autoCorrectedDatePipe
ember install ember-text-mask-addonsThe addon provides Ember components that can be used directly in templates.
You can also import the masks or pipes and use them with the {{masked-input}} component provided by Ember-text-mask.
To import and use the emailMask:
import { emailMask } from 'ember-text-mask-addons';
// ... do something with the emailMaskIf you wanted to use the emailMask with the {{masked-input}} component, you would do this:
import Ember from 'ember';
import { emailMask } from 'ember-text-mask-addons';
export default Ember.Controller.extend({
emailMask: emailMask
});You can use the createNumberMask() method to create a numberMask.
import Ember from 'ember';
import { createNumberMask } from 'ember-text-mask-addons';
export default Ember.Controller.extend({
numberMask: createNumberMask()
});Then you can use the numberMask with the {{masked-input}} component.
You can use the createAutoCorrectedDatePipe() method to create an autoCorrectedDatePipe.
import Ember from 'ember';
import { createAutoCorrectedDatePipe } from 'ember-text-mask-addons';
export default Ember.Controller.extend({
autoCorrectedDatePipe: createAutoCorrectedDatePipe('mm/dd/yyyy')
});Then you can use the autoCorrectedDatePipe with the {{masked-input}} component.
See Text Mask Addons for more information and usage instructions.
For more information about the attributes that the {{masked-input}} component accepts, see the documentation here.
To see an example of the code running, follow these steps:
- Clone the repo,
git clone git@github.com:text-mask/ember-text-mask-addons.git cd ember-text-mask-addonsnpm installbower installember server- Open http://localhost:4200
Public domain - CC0 1.0 Universal