Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 30c5344

Browse files
committed
Fixes #38, reorganized home.html to make it clear that the default options are part of the initial config
1 parent 705fa4e commit 30c5344

File tree

2 files changed

+48
-51
lines changed

2 files changed

+48
-51
lines changed

src/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ app.config(function($stateProvider, $urlRouterProvider, $locationProvider, forml
2929
});
3030
}
3131

32-
formlyOptionsProvider.setOption('uniqueFormId', 'whyConfigureUniqueId');
32+
formlyOptionsProvider.setOption('uniqueFormId', 'defaultUniqueId');
3333
// or
3434
formlyOptionsProvider.setOption({
3535
submitCopy: 'Configured Submit',

src/views/home.html

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,57 @@ <h1>Formly for Angular</h1>
77
</div>
88
<div class="container-fluid">
99
<div class="row">
10-
<div class="col-sm-4 col-md-4 col-lg-4"
11-
ng-hide="editJSON">
12-
13-
<!-- Formatted JSON -->
14-
<button class="btn btn-success"
15-
ng-click="editJSON = true">
16-
Edit JSON
17-
</button>
18-
19-
<button class="btn btn-success"
20-
ng-click="toggleCustomTypeTemplates()">
21-
{{typeTemplatesButton}}
22-
</button>
23-
24-
<h3>Options</h3>
25-
<div source="toPrettyJSON(formOptions, 4)"
26-
hljs>
27-
</div>
28-
29-
<h3>Fields</h3>
30-
<div source="toPrettyJSON(formFields, 4)"
31-
hljs>
32-
</div>
33-
</div>
10+
<div class="col-sm-4 col-md-4 col-lg-4">
11+
<!-- Pre configured options -->
12+
<h3>Configured Default Options</h3>
13+
<div hljs source="preConfiguredOptions|json"></div>
3414

35-
<div class="col-sm-4 col-md-4 col-lg-4"
36-
ng-show="editJSON">
15+
<span>
16+
<!-- Formatted JSON -->
17+
<button class="btn btn-success"
18+
ng-click="editJSON = true"
19+
ng-hide="editJSON">
20+
Edit JSON
21+
</button>
22+
<button class="btn btn-success"
23+
ng-click="editJSON = false"
24+
ng-show="editJSON">
25+
Pretty JSON
26+
</button>
3727

38-
<!-- Edit JSON -->
39-
<button class="btn btn-success"
40-
ng-click="editJSON = false">
41-
Pretty JSON
42-
</button>
28+
<button class="btn btn-success"
29+
ng-click="toggleCustomTypeTemplates()">
30+
{{typeTemplatesButton}}
31+
</button>
4332

44-
<h3>Options</h3>
45-
<div class="form-group"
46-
ng-class="{'has-error': formOptionsError}">
47-
<textarea class="form-control"
48-
ng-model="formOptionsStr"
49-
rows="5">
50-
</textarea>
51-
</div>
33+
<h3>Options (Overrides configured default options)</h3>
34+
<div class="form-group"
35+
ng-class="{'has-error': formOptionsError}"
36+
ng-show="editJSON">
37+
<textarea class="form-control"
38+
ng-model="formOptionsStr"
39+
rows="5">
40+
</textarea>
41+
</div>
42+
<div source="toPrettyJSON(formOptions, 4)"
43+
ng-hide="editJSON"
44+
hljs>
45+
</div>
5246

53-
<h3>Fields</h3>
54-
<div class="form-group"
55-
ng-class="{'has-error': formFieldsError}">
56-
<textarea class="form-control"
57-
ng-model="formFieldsStr"
58-
rows="15">
59-
</textarea>
60-
</div>
47+
<h3>Fields</h3>
48+
<div class="form-group"
49+
ng-class="{'has-error': formFieldsError}"
50+
ng-show="editJSON">
51+
<textarea class="form-control"
52+
ng-model="formFieldsStr"
53+
rows="15">
54+
</textarea>
55+
</div>
56+
<div source="toPrettyJSON(formFields, 4)"
57+
ng-hide="editJSON"
58+
hljs>
59+
</div>
60+
</span>
6161
</div>
6262
<div class="col-sm-4 col-md-4 col-lg-4">
6363

@@ -106,9 +106,6 @@ <h3>Form State</h3>
106106
</tbody>
107107

108108
</table>
109-
110-
<h3>Configured Default Options</h3>
111-
<div hljs source="preConfiguredOptions|json"></div>
112109
</div>
113110
</div>
114111
</div>

0 commit comments

Comments
 (0)