-
Notifications
You must be signed in to change notification settings - Fork 48
/
app.js
63 lines (62 loc) · 1.43 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*global angular */
'use strict';
/**
* The main app module
* @name app
* @type {angular.Module}
*/
var app = angular.module('app', ['schemaForm-strapselect', 'pascalprecht.translate'])
.controller('SelectController', function($scope){
$scope.schema = {
type: 'object',
title: 'Select',
properties: {
name: {
title: 'Name',
type: 'string'
},
select: {
title: 'Single Select',
type: 'string',
format: 'strapselect',
description: 'Only single item is allowd',
items: [
{value: 'value1', label: 'label1'},
{value: 'value2', label: 'label2'},
{value: 'value3', label: 'label3'}
]
},
multiselect: {
title: 'Multi Select',
type: 'array',
format: 'strapselect',
description: 'Multi single items arre allowd',
items: [
{value: 'value1', label: 'label1'},
{value: 'value2', label: 'label2'},
{value: 'value3', label: 'long very very long label3'}
]
}
},
required: ['select', 'multiselect']
};
$scope.form = [
'name',
{
key: 'select'
},
{
key: 'multiselect'
},
{
type: "submit",
style: "btn-info",
title: "OK"
}
];
$scope.model = {};
$scope.submitted = function(form){
$scope.$broadcast('schemaFormValidate')
console.log($scope.model);
};
});