us-formly-templates
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "us-formly-templates", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Extensão com templates para usar formly com bootstrap", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -28,3 +28,3 @@ angular.module('usFormlyTemplates', [ | ||
extends: 'input', | ||
template: '<input class="form-control" ng-model="model[options.key]" />', | ||
template: '<input class="form-control" model-view-value="true" ng-model="model[options.key]" />', | ||
defaultOptions: { | ||
@@ -52,5 +52,6 @@ ngModelAttrs: { | ||
cpf: { | ||
expression: function(viewValue, modelValue) { | ||
expression: function(viewValue, modelValue, scope) { | ||
var cpf = modelValue || viewValue; | ||
if(cpf){ | ||
cpf = cpf.replace(/\.|\-/g, ''); | ||
if (cpf.length != 11 || | ||
@@ -88,3 +89,5 @@ cpf == "00000000000" || | ||
return true; | ||
} | ||
} else if (!scope.to.required) { | ||
return true; | ||
} | ||
return false; | ||
@@ -104,6 +107,7 @@ }, | ||
name: 'rg', | ||
extends: 'maskedInput', | ||
//extends: 'maskedInput', | ||
extends: 'input', | ||
defaultOptions: { | ||
templateOptions: { | ||
mask: '99.999.999-9', | ||
//mask: '99.999.999-9', | ||
} | ||
@@ -120,5 +124,6 @@ } | ||
cnpj: { | ||
expression: function(viewValue, modelValue) { | ||
expression: function(viewValue, modelValue, scope) { | ||
var cnpj = modelValue || viewValue; | ||
if(cnpj){ | ||
cnpj = cnpj.replace(/[^\d]+/g,''); | ||
if (cnpj == "00000000000000" || | ||
@@ -164,3 +169,5 @@ cnpj == "11111111111111" || | ||
return true; | ||
} | ||
} else if (!scope.to.required) { | ||
return true; | ||
} | ||
return false; | ||
@@ -307,4 +314,2 @@ }, | ||
type="text" | ||
id="{{::id}}" | ||
name="{{::id}}" | ||
ng-model="model[options.key]" | ||
@@ -329,4 +334,4 @@ class="form-control" | ||
datepickerOptions: { | ||
format: 'dd.MM.yyyy', | ||
initDate: new Date() | ||
format: 'dd/MM/yyyy', | ||
initDate: new Date() | ||
} | ||
@@ -343,2 +348,9 @@ } | ||
}; | ||
// carregamento com abas | ||
$scope.$watch('model.'+$scope.options.key, function(value) { | ||
if (typeof ($scope.model[$scope.options.key]) == 'string') { | ||
$scope.model[$scope.options.key] = new Date($scope.model[$scope.options.key]); | ||
} | ||
}); | ||
}] | ||
@@ -345,0 +357,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14174
412