blob: badb886b0dd577dc8921644ac45d921c07e7b24f [file] [log] [blame]
Matteo Scandolo686547a2017-08-08 13:05:25 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
Arpit Agarwal43978742016-08-09 15:38:25 -070019'use strict';
20
21angular.module('ngXosLib')
22 .component('fieldTest', {
23 restrict: 'E',
24 bindings: {},
25 bindToController: true,
26 controllerAs: 'vm',
27 templateUrl: 'templates/field.dev.html',
28 controller: function () {
29 this.field1 = {
30 name: 'number-field',
31 field: {label: 'My Number Value:', type: 'number'},
32 model: 2
33 };
34
35 this.field2 = {
36 name: 'date-field',
37 field: {label: 'My Date Value:', type: 'date'},
38 model: new Date()
39 };
40
41 this.field3 = {
42 name: 'boolean-field',
43 field: {label: 'My Boolean Value:', type: 'boolean'},
44 model: true
45 };
46
47 this.field4 = {
48 name: 'email-field',
49 field: {label: 'My Email Value:', type: 'email'},
50 model: 'sample@domain.us'
51 };
52 this.field5 = {
53 name: 'Empty Object Field',
54 label: 'Empty Object Field',
55 type: 'object',
56 properties: {
57 foo: {
58 label: 'FooLabel:',
59 type: 'string',
60 validators: {
61 required: true
62 }
63 },
64 bar: {
65 type: 'number'
66 }
67 }
Matteo Scandolo65116c42016-09-21 17:06:23 -070068 };
69
70 this.selectField = {
71 name: 'select',
72 label: 'Select field:',
73 type: 'select',
74 model: 1,
75 options: [
76 {id: 1, label: 'One'},
77 {id: 2, label: 'Two'},
78 {id: 3, label: 'Three'},
79 ]
Arpit Agarwal43978742016-08-09 15:38:25 -070080 }
Matteo Scandolo65116c42016-09-21 17:06:23 -070081
82 this.arrayField = {
83 name: 'array',
84 label: 'Array field:',
85 model: ['one', 'two', 'three'],
86 type: 'array',
87 options: ['one', 'two', 'three', 'four']
88 };
Arpit Agarwal43978742016-08-09 15:38:25 -070089 }
90 });