blob: 99afda08b802e2de121169531e18eba3b136f84f [file] [log] [blame]
'use strict';
angular.module('ngXosLib')
.component('formTest', {
restrict: 'E',
bindings: {},
bindToController: true,
controllerAs: 'vm',
templateUrl: 'templates/form.dev.html',
controller: function () {
this.model = {
first_name: 'Jhon',
last_name: 'Doe',
},
this.config = {
exclude: ['password', 'last_login'],
formName: 'sampleForm',
actions: [
{
label: 'Save',
icon: 'ok', // refers to bootstraps glyphicon
cb: (user) => { // receive the model
console.log(user);
},
class: 'success'
}
],
fields: {
first_name: {
type: 'string',
validators: {
required: true
}
},
last_name: {
label: 'Surname',
type: 'string',
validators: {
required: true,
minlength: 10
}
},
details_field: {
label: 'Empty Object Field',
type: 'object',
properties: {
foo: {
label: 'FooLabel:',
type: 'string',
validators: {
required: true
}
},
bar: {
type: 'number'
}
}
}
}
}
}
})