angular-ui / ui-mask

Mask on an input field so the user can only type pre-determined pattern
https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html
MIT License
391 stars 258 forks source link

Change ui-mask format on the fly #207

Open dickyjayaumbara opened 7 years ago

dickyjayaumbara commented 7 years ago

hey guys, i have probem with chage ui-mask on the fly,

this my component code: <input type="input" ng-model="item.totalKlaim" ui-mask="{{mask}}" ng-keyup="updateCurrencyMask(item.totalKlaim)"/>

and this update function for ui-mask:

$scope.updateCurrencyMask = function(value)
            {
                if(value != "")
                {
                    var lengthValue = value.length;

                    var mask = "Rp ";
                    var formatNumber = "";

                    for(var i=0; i<lengthValue; i++)
                    {
                        formatNumber += "9";
                    }

                    formatNumber = commafy(formatNumber);

                    $scope.mask = "Rp "+formatNumber;
                }
            }

ui-mask just detect default "mask", iam cannot update value again after that, can u help me for this case please

dickyjayaumbara commented 7 years ago

or other way, how to use ui-mas for unlimited number of currency?

gophynna commented 5 years ago

Did you ever figure out how to do this?

soumyamishra12 commented 5 years ago

I didn't have any work around for the same after downgrading to 1.6.1 it worked

On Wed, Sep 19, 2018, 3:09 AM gophynna notifications@github.com wrote:

Did you ever figure out how to do this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/angular-ui/ui-mask/issues/207#issuecomment-422565578, or mute the thread https://github.com/notifications/unsubscribe-auth/AeJUlXhG6UIYJ832R2fv41Y1cVJrU_juks5ucWglgaJpZM4LfMFO .

gophynna commented 5 years ago

I didn't have any work around for the same after downgrading to 1.6.1 it worked On Wed, Sep 19, 2018, 3:09 AM gophynna @.***> wrote: Did you ever figure out how to do this? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#207 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AeJUlXhG6UIYJ832R2fv41Y1cVJrU_juks5ucWglgaJpZM4LfMFO .

Can you show how you implemented your mask? thank you!

soumyamishra12 commented 5 years ago

I am using ui-mask same way without tweaking much as shown in ui-mask demo in angular formly page and the 1.6.2 version works perfectly and ng mask also

Regards, Soumya

On Wed, Sep 19, 2018, 8:18 PM gophynna notifications@github.com wrote:

I didn't have any work around for the same after downgrading to 1.6.1 it worked … <#m1984108355977040089> On Wed, Sep 19, 2018, 3:09 AM gophynna @.***> wrote: Did you ever figure out how to do this? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#207 (comment) https://github.com/angular-ui/ui-mask/issues/207#issuecomment-422565578>, or mute the thread https://github.com/notifications/unsubscribe-auth/AeJUlXhG6UIYJ832R2fv41Y1cVJrU_juks5ucWglgaJpZM4LfMFO .

Can you show how you implemented your mask? thank you!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular-ui/ui-mask/issues/207#issuecomment-422832602, or mute the thread https://github.com/notifications/unsubscribe-auth/AeJUlcNvEjO4jQHYh8IJm5VVNGWxmKtzks5uclkogaJpZM4LfMFO .

gophynna commented 5 years ago

Will downgrading allow the user to keep typing even after the mask is applied? My problem is that even with a variable for the mask, it will not let input continue once a mask has been applied.

@soumyamishra12

soumyamishra12 commented 5 years ago

Can u show the issue in plunker it somewhere if possible

On Thu, Sep 20, 2018, 7:57 PM gophynna notifications@github.com wrote:

Will downgrading allow the user to keep typing even after the mask is applied? My problem is that even with a variable for the mask, it will not let input continue once a mask has been applied.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular-ui/ui-mask/issues/207#issuecomment-423203896, or mute the thread https://github.com/notifications/unsubscribe-auth/AeJUlXpytvss-Yck43htwW_lx01VwreCks5uc6XhgaJpZM4LfMFO .