Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 1 | 'use strict';
|
| 2 |
|
| 3 | angular.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 Scandolo | 65116c4 | 2016-09-21 17:06:23 -0700 | [diff] [blame] | 50 | };
|
| 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 Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 62 | }
|
Matteo Scandolo | 65116c4 | 2016-09-21 17:06:23 -0700 | [diff] [blame] | 63 |
|
| 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 Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 71 | }
|
| 72 | }); |