Validation angular-formly not number

94 views
Skip to first unread message

fabio zacarias

unread,
Jan 19, 2016, 8:05:09 AM1/19/16
to AngularJS
good Morning!
excuse my lack of knowledge , I am new to the angular-formly and I wonder how and where should I create a validation for did not accept the input numbers.
my code is below. Captures the value on the screen, remove the number over not appear on the new format screen
help

sorry the English using google translator

.run(function(formlyConfig) {
formlyConfig.setType({
name: 'fabio',
extends: 'input',
template: '<input class="form-control" id="fabio" ng-model="model[options.key]" ng-change="soChar()" ng-controller="AlterardadospesCtrl">',
wrapper: ['bootstrapLabel', 'bootstrapHasError'],
defaultOptions: {
validators: {
soChar : function ($viewValue, $modelValue) {
var teste1 = $viewValue.replace(/[0-9]+/g,'')
}
}
},
})
})

Json
{
"className": "col-md-5 ",
"type": "fabio",
"key": "Nome",
"templateOptions": {
"type": "text",
"label": "Nome"
}
},
Reply all
Reply to author
Forward
0 new messages