angularjsangular-uideclarationmaskangularjs-ui-utils

Input Mask with angular-input-masks


I wanted to make input mask, in case CNPJ.

Then I saw it here.

https://github.com/assisrafael/angular-input-masks/

But not getting to implement.

See the excerpt from my code, in which case it did not work.

<html>
<head>
    <meta charset="utf-8">
    <script src="angular.js"></script>
    <script src="js/masks.min.js"></script>

    <script>
        angular.module('ui.utils.masks');
    </script>

</head>
<body ng-app>
    <ul>
        <li><a href="teste.html">Teste</a></li>
    </ul>

    <div>
        <label>CNPJ:</label>
        <input type="text" ng-model="cnpj" ui-br-cnpj-mask>
    </div>

</body>
</html>

What is missing to work?


Solution

  • Declare module like below.

    angular.module('app',['ui.utils.masks'])
    

    And then change ng-app on HTML like below.

    ng-app="app"
    

    This would help you. Thanks.