question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to apply mask on the fly

See original GitHub issue

Hi, thanks for the plugin. I am adding this issue because it would be really appreciated if you add an option to allow apply masks on the fly. i am trying to set some common masks shortcuts using a directive, but i can’t get it to work. I’m fairly new to angularjs, and any help would be greatly appreciated.

here is the code of my custom directive to alter input in the dom, to add the ngMask plugin attributes:

angular.module(‘myApp’, [‘ngMask’]) .directive(‘applyMask’, function () { return { restrict: ‘A’, controller: function ($element) { var maskType = $element[0].attributes[‘apply-mask’].value; switch (maskType) { case ‘phone’: { $element.attr(‘mask’, ‘(ddd) - ddd-dddd’) .attr(‘mask-restrict’, ‘reject’) .attr(‘mask-clean’, ‘true’); } break;

                }
            },
            compile: function (element, attributes) {

                return {
                    pre: function (scope, element, attributes, controller, transcludeFn) {
                        var maskType = attributes["applyMask"];
                        switch (maskType) {
                            case 'phone': {
                                element.attr('mask', '(ddd) - ddd-dddd')
                                    .attr('mask-restrict', 'reject')
                                    .attr('mask-clean', 'true');
                            } break;

                        }
                    },
                    post: function (scope, element, attributes, controller, transcludeFn) {
                        var maskType = attributes["applyMask"];
                        switch (maskType) {
                            case 'phone': {
                                element.attr('mask', '(ddd) - ddd-dddd')
                                    .attr('mask-restrict', 'reject')
                                    .attr('mask-clean', 'true');
                            } break;

                        }
                    }
                }
            }
        }
    });

and here it is the way i am trying to apply to an input element:

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
daric81commented, Aug 14, 2017

+1 Anything happening with this request? Using a variable to bind to seems like a common scenario.

0reactions
k4fer74commented, Aug 8, 2016

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image masking tutorial - YouTube
How to use the Apply Mask to Image feature in LightBurnIf you need help, please join our support forum at http://forum.lightburnsoftware.com ...
Read more >
Masks in DaVinci Resolve - YouTube
Learn to create masks in the Color and Fusion tabs inside of DaVinci Resolve. Found this video useful and want to say a...
Read more >
How to Use Masks in After Effects - School of Motion
To create a mask, you first need to select the layer you want to apply it to. Then grab a shape tools from...
Read more >
Apply/Remove Masks in Layer List - IFTDSS
Select Apply Mask from the drop-down menu. the 'apply mask' feature is available from the 'more options' button in. Select your shape or...
Read more >
Use masks to hide layers in Photoshop - Adobe Support
To create a mask that hides the entire layer, Alt-click (Win) or Option-click (Mac) the Add Layer Mask button, or choose Layer >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found