angular-ui / angular-ui.github.com

Angular UI homepage
https://angular-ui.github.com/
79 stars 61 forks source link

Masking Help #97

Closed daddyschmack closed 9 years ago

daddyschmack commented 9 years ago

Hi, This is probably a real noob question.. but I'm trying to implement the masking, and the mask works very well, but I can't get a value out.. (This is my first angular app, and my boss insists on masking)

This is my input: "<input type="tel" id="phone" ng-model="phone" ng-trim placeholder="123.456.7890" title="123.456.7890" ng-value="" pattern="^(\d{3}).. $" ng-change="phoneOutput()" ui-mask="999.999.9999" >"

Here is the app declaration: var sigApp = angular.module('sigApp',['ngSanitize','ui.utils']);

and I'm trying to get the value in this function sigApp.controller("SigController", ['$scope','$sce', function($scope,$sce) { $scope.direct = ''; $scope.mobile = ''; $scope.phone = ''; $scope.phoneOutput = function() { $scope.validate = true; var phoneCount = 0; var dir = $scope.direct.$viewValue; var mob = $scope.mobile.$viewValue; var off = $scope.phone.$viewValue; console.log('dir ' + dir); console.log('mobile ' + mob); console.log('phone ' + off); ... }); I'm getting errors when I try tor reference the view value.

Can you provide some insight?

Thanks!!!

John

karianna commented 9 years ago

Hi @daddyschmack - you're better off asking this question on Stackoverflow and coming back here if there's a bug report to be made (SO has better support for Q's) :-).

daddyschmack commented 9 years ago

Thanks, Do I need to delete this post?

karianna commented 9 years ago

No that's fine - I've just closed it for now.