How to work with ui-mask in input angularjs

8
<form name="myForm" ng-submit="addState(myForm.$valid)" novalidate >

        <input ng-model="data.cnpj" type="number" ui-mask="999.999.999-99" placeholder="CNPJ" required ng-minlength="6" ng-maxlength="12" ng-pattern="/^[0-9]{1,7}[-\.\/]?+$/">
 </form>

What do I need to put in the controller for ui-mask to work?

I tried this but it did not work.

mainAppControllers.controller('Ctrl', ['myservice','$rootScope','$scope', '$routeParams', '$location','$timeout',
function(myservice, $rootScope, $scope, $routeParams, $location,$timeout ){
    
asked by anonymous 28.01.2015 / 20:18

1 answer

6

Looking at your review, if the first tag

<input ng-model="data.cnpj" type="text" ui-mask="999.999.999-99" ng-pattern="/^[0-9]{1,7}[-\.\/]?+$/"> 

worked, change the second to

<input ng-model="data.data" type="text" ui-mask="99/99/9999" ng-pattern="/^[0-9]{1,7}[-\.\/]?+$/">
    
04.02.2015 / 14:56