blob: b9552535c979fd6502a315487e103496c48bb9b4 [file] [log] [blame]
Arpit Agarwal43978742016-08-09 15:38:25 -07001'use strict';
2
3angular.module('ngXosLib')
4 .component('formTest', {
5 restrict: 'E',
6 bindings: {},
7 bindToController: true,
8 controllerAs: 'vm',
9 templateUrl: 'templates/form.dev.html',
10 controller: function () {
11 this.model = {
12 first_name: 'Jhon',
13 last_name: 'Doe',
14 },
15 this.config = {
16 exclude: ['password', 'last_login'],
17 formName: 'sampleForm',
18 actions: [
19 {
20 label: 'Save',
21 icon: 'ok', // refers to bootstraps glyphicon
22 cb: (user) => { // receive the model
23 console.log(user);
24 },
25 class: 'success'
26 }
27 ],
Steven Burrows84818482016-09-29 15:33:46 -070028 order: ['last_name', 'select'],
Arpit Agarwal43978742016-08-09 15:38:25 -070029 fields: {
30 first_name: {
31 type: 'string',
32 validators: {
33 required: true
34 }
35 },
36 last_name: {
37 label: 'Surname',
38 type: 'string',
39 validators: {
40 required: true,
41 minlength: 10
42 }
43 },
Matteo Scandoloe57712f2016-09-21 15:27:36 -070044 select: {
45 label: 'select',
46 type: 'select',
47 options: [
48 {id: 1, label: 'a'},
49 {id: 2, label: 'b'}
50 ]
51 },
Arpit Agarwal43978742016-08-09 15:38:25 -070052 details_field: {
53 label: 'Empty Object Field',
54 type: 'object',
55 properties: {
56 foo: {
57 label: 'FooLabel:',
58 type: 'string',
59 validators: {
60 required: true
61 }
62 },
63 bar: {
64 type: 'number'
65 }
66 }
67 }
68 }
69 }
70 }
Steven Burrows84818482016-09-29 15:33:46 -070071 })