Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how use two masks on v0.4.x? #36

Open
joseholanda opened this issue Jun 22, 2017 · 4 comments
Open

how use two masks on v0.4.x? #36

joseholanda opened this issue Jun 22, 2017 · 4 comments
Labels

Comments

@joseholanda
Copy link

joseholanda commented Jun 22, 2017

How to make it possible to insert two masks on v.0.4.x version ?

In v.0.2.x version I did like this:

didRender() {
    this._super(...arguments);
    this.$('#'+this.get('id')).inputmask({
      mask: ['(99) 9999-9999','(99) 99999-9999'],
      showMaskOnHover: true,
      showMaskOnFocus: true,
      clearMaskOnLostFocus: true
    });
  }
@leizhao4
Copy link
Collaborator

@joseholanda I don't fully understand the question.

In order to have two masks, you simply create two {{input-mask}} components in your template:

{{input-mask mask='(99) 9999-9999' showMaskOnHover=true showMaskOnFocus=true
  clearMaskOnLostFocus=true}}
{{input-mask mask='(99) 99999-9999' showMaskOnHover=true showMaskOnFocus=true
  clearMaskOnLostFocus=true}}

The above template should just work. If it doesn't, then It's a bug and we should fix it.

The usage you showed looks like the old 'jQuery' way, not the 'Ember' way.

@leizhao4
Copy link
Collaborator

Ah, I see what you are saying. Unfortunately I don't personally have experience with this use case.

I was assuming that passing an array as mask would work:

export default Ember.Component.extend({
  mask: ['(99) 9999-9999', '(99) 99999-9999']
});
{{input-mask mask=mask}}

But this didn't in my test. So I'm guessing somewhere in the library code only accepts mask in string format. I need to look deeper to see where this is happening. But I probably won't have enough time in next 2-3 weeks (just moved to a new city and will start a new job). So any help/PR is greatly appreciated.

@brandynbennett
Copy link
Collaborator

brandynbennett commented Jan 30, 2019

@joseholanda do alternator masks work for your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants