blob: 1f5962986775013a0503e9c626ebcc6616bacb88 [file] [log] [blame]
Arpit Agarwal43978742016-08-09 15:38:25 -07001'use strict';
2
3angular.module('ngXosLib')
4 .component('fieldTest', {
5 restrict: 'E',
6 bindings: {},
7 bindToController: true,
8 controllerAs: 'vm',
9 templateUrl: 'templates/field.dev.html',
10 controller: function () {
11 this.field1 = {
12 name: 'number-field',
13 field: {label: 'My Number Value:', type: 'number'},
14 model: 2
15 };
16
17 this.field2 = {
18 name: 'date-field',
19 field: {label: 'My Date Value:', type: 'date'},
20 model: new Date()
21 };
22
23 this.field3 = {
24 name: 'boolean-field',
25 field: {label: 'My Boolean Value:', type: 'boolean'},
26 model: true
27 };
28
29 this.field4 = {
30 name: 'email-field',
31 field: {label: 'My Email Value:', type: 'email'},
32 model: 'sample@domain.us'
33 };
34 this.field5 = {
35 name: 'Empty Object Field',
36 label: 'Empty Object Field',
37 type: 'object',
38 properties: {
39 foo: {
40 label: 'FooLabel:',
41 type: 'string',
42 validators: {
43 required: true
44 }
45 },
46 bar: {
47 type: 'number'
48 }
49 }
Matteo Scandolo65116c42016-09-21 17:06:23 -070050 };
51
52 this.selectField = {
53 name: 'select',
54 label: 'Select field:',
55 type: 'select',
56 model: 1,
57 options: [
58 {id: 1, label: 'One'},
59 {id: 2, label: 'Two'},
60 {id: 3, label: 'Three'},
61 ]
Arpit Agarwal43978742016-08-09 15:38:25 -070062 }
Matteo Scandolo65116c42016-09-21 17:06:23 -070063
64 this.arrayField = {
65 name: 'array',
66 label: 'Array field:',
67 model: ['one', 'two', 'three'],
68 type: 'array',
69 options: ['one', 'two', 'three', 'four']
70 };
Arpit Agarwal43978742016-08-09 15:38:25 -070071 }
72 });