noobcoder
noobcoder

Reputation: 12861

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 (https://github.com/angular-ui/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">
  </div>
</div>

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

Upvotes: 1

Views: 1356

Answers (1)

ehecatl
ehecatl

Reputation: 170

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', ...])

Edit: put together a minimal working plunker.

Upvotes: 3

Related Questions