noobcoder noobcoder - 1 year ago 82
Javascript Question

angular-ui-mask doesn't mask as expected in the text box

I am using angular for my web-application and trying to use angular-ui-mask ( to mask the input to prevent someone from even typing anything but numbers in the text box. I've tried everything the doc suggested but I just cannot put it to use. Here is my textbox code snippet.

<div class="form-group"><label class="col-sm-2 control-label">Memo</label>
<div class="col-sm-10">
<input type="text" class="form-control" ui-mask="99-999-9999" ng-model="vm.textField">

Not sure if I am missing something or need to add something in my controller. Any clue ?

Answer Source

Perhaps you forgot to load the script files...

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-mask/dist/mask.js"></script>

...or add the module to your dependencies?

angular.module('myApp', ['ui.mask', ...])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download