Skip to content

Commit

Permalink
Release 0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Henke committed Jun 20, 2014
1 parent 7ce1131 commit 6cef629
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions dist/syoAngular.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,16 +923,27 @@

definition.link = function( $scope, $element, $attr, ngModel ) {
var viewValue, oldFn;
var mask = $attr.uiMask || "";
var optional = mask.indexOf( "?" );

if ( !$attr.uiMask ) {
if ( !mask ) {
return;
}

oldFn = ngModel.$setViewValue;
ngModel.$setViewValue = function( val ) {
oldFn.call( this, val );
var unfilledIndex;

oldFn.call( this, val );
viewValue = ngModel.$viewValue;

// Se tem parte da mascara que é opcional e não foi preenchida, corta até ela
// e fica com o que tem antes
unfilledIndex = viewValue.indexOf( "_", optional );
if ( ~optional && ~unfilledIndex ) {
viewValue = viewValue.substring( 0, unfilledIndex );
}

ngModel.$parsers.push(function() {
return viewValue;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "syo-bootstrap",
"version": "0.2.3",
"version": "0.2.4",
"title": "Syonet Bootstrap",
"description": "O conjunto de ferramentas front-end da Syonet",
"author": {
Expand Down

0 comments on commit 6cef629

Please sign in to comment.