forked from formly-js/angular-formly-templates-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
80 lines (72 loc) · 2.07 KB
/
index.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Quick Example</title>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css"/>
</head>
<body ng-app="app" ng-controller="MainCtrl as vm">
<div class="jumbotron text-center">
<h1>angular-formly-templates-bootstrap</h1>
</div>
<div class="container">
<div class="row">
<formly-form model="vm.model" fields="vm.fields" options="vm.options" form="vm.form"></formly-form>
</div>
<div class="row">
<h2>Model</h2>
<pre>{{vm.model | json}}</pre>
</div>
<div class="row">
<h2>Form</h2>
<pre>{{vm.form | json}}</pre>
</div>
<div class="row">
<h2>Original Fields</h2>
<pre>{{vm.originalFields | json}}</pre>
</div>
<div class="row">
<h2>Options</h2>
<pre>{{vm.options}}</pre>
</div>
</div>
<script src="node_modules/api-check/dist/api-check.js"></script>
<script src="node_modules/angular/angular.js"></script>
<script src="node_modules/angular-formly/dist/formly.js"></script>
<script src="dist/angular-formly-templates-bootstrap.js"></script>
<script>
var app = angular.module('app', ['formly', 'formlyBootstrap']);
app.controller('MainCtrl', function MainCtrl() {
var vm = this;
vm.model = {};
vm.options = {};
vm.fields = [
{
type: 'input',
key: 'text',
templateOptions: {
label: 'First input',
placeholder: 'It works!'
}
},
{
type: 'select',
key: 'avenger',
templateOptions: {
label: 'Favorite Avenger',
options: [
{name: 'Iron Man', value: 'iron_man', gender: 'Male'},
{name: 'Captain America', value: 'captain_america', gender: 'Male'},
{name: 'Black Widow', value: 'black_widow', gender: 'Female'},
{name: 'Hulk', value: 'hulk', gender: 'Male'},
{name: 'Captain Marvel', value: 'captain_marvel', gender: 'Female'}
],
groupProp: 'gender'
}
}
];
vm.originalFields = angular.copy(vm.fields);
});
</script>
</body>
</html>