You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-31
Original file line number
Diff line number
Diff line change
@@ -7,25 +7,31 @@ Angular Schema Form
7
7
8
8
Generate forms from JSON schemas using AngularJS!
9
9
10
-
### [Try out the example page](http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html)
10
+
Demo Time!
11
+
----------
12
+
[Try out the example page](http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html).
11
13
Try editing the schema or form definition and see what comes out!
12
14
13
15
What is it?
14
16
----------
15
17
16
-
Schema Form is a set of AngularJS directives (and a couple of services). It can do two things to make life easier:
18
+
Schema Form is a set of AngularJS directives (and a couple of services). It can do two things to
19
+
make life easier:
17
20
18
21
1. Create a form directly from a JSON schema.
19
22
2. Validate form fields against that same JSON schema.
20
23
21
-
Schema Form uses convention over configuration, so it comes packaged with some sensible defaults. But you can always customize it by changing the order and types of form fields.
24
+
Schema Form uses convention over configuration, so it comes packaged with some sensible defaults.
25
+
But you can always customize it by changing the order and types of form fields.
22
26
23
-
JSON Form
24
-
---------
25
-
Schema Form is inspired by the nice [JSON Form](https://github.com/joshfire/jsonform) library and aims to be roughly compatible with it, especially its form definition. So what sets Schema Form apart from JSON Form?
27
+
#### JSON Form
28
+
Schema Form is inspired by the nice [JSON Form](https://github.com/joshfire/jsonform) library and
29
+
aims to be roughly compatible with it, especially its form definition. So what sets Schema Form
30
+
apart from JSON Form?
26
31
27
32
1. Schema Form integrates deeply with AngularJS and uses AngularJS conventions to handle forms.
28
-
2. Schema Form uses [tv4](https://github.com/geraintluff/tv4) for validation, making it compatible with version 4 of the JSON schema standard.
33
+
2. Schema Form uses [tv4](https://github.com/geraintluff/tv4) for validation, making it compatible
34
+
with version 4 of the JSON schema standard.
29
35
3. By default, Schema Form generates Bootstrap 3-friendly HTML.
30
36
31
37
@@ -35,7 +41,8 @@ Basic Usage
35
41
First, expose your schema, form, and model to the $scope.
36
42
37
43
```javascript
38
-
functionFormController($scope) {
44
+
angular.module('myModule', ['schemaForm'])
45
+
.controller('FormController', function($scope) {
39
46
$scope.schema= {
40
47
type:"object",
41
48
properties: {
@@ -56,7 +63,7 @@ function FormController($scope) {
56
63
];
57
64
58
65
$scope.model= {};
59
-
}
66
+
});
60
67
```
61
68
62
69
Then load them into Schema Form using the `sfSchema`, `sfForm`, and `sfModel` directives.
@@ -68,7 +75,6 @@ Then load them into Schema Form using the `sfSchema`, `sfForm`, and `sfModel` di
68
75
```
69
76
70
77
71
-
72
78
Documentation
73
79
-------------
74
80
Documentation covering defaults and form types [can be found here.](docs/index.md)
@@ -133,22 +139,45 @@ also needs to be loaded *before* Schema Form.
Your can also [create your own add-ons!](docs/extending.md)
159
+
160
+
Contributing
161
+
------------
162
+
163
+
All contributions are welcome! If its a new field type consider making it an add-on instead,
164
+
especially if it has dependecies. See [extending Schema Form documentation.](docs/extending.md)
165
+
166
+
We're trying to use
167
+
[git flow](http://danielkummer.github.io/git-flow-cheatsheet/), *so please base any merge request on the **development** branch instead of **master**.*
168
+
169
+
Also run any code through the code style checker [jscs](https://github.com/mdevils/node-jscs)
170
+
(or even better use it in your editor) with preset set to `google`. You can also us `gulp jscs` to
171
+
check your code.
144
172
145
-
Your can also [create your own add-ons.](docs/extending.md)
146
173
147
174
Building
148
175
--------
149
-
The files in the `dist/` folder, plus dependencies, are all you need to use Schema Form. But if you'd like to build it yourself, we use [gulp](http://gulpjs.com/).
176
+
The files in the `dist/` folder, plus dependencies, are all you need to use Schema Form. But if
177
+
you'd like to build it yourself, we use [gulp](http://gulpjs.com/).
150
178
151
-
First off, you need to have nodejs installed. Then install all dev dependencies of the project with npm, install gulp and run the default task.
179
+
First off, you need to have nodejs installed. Then install all dev dependencies of the
180
+
project with npm, install gulp and run the default task.
152
181
153
182
```bash
154
183
$ npm install
@@ -157,13 +186,17 @@ $ bower install
157
186
$ gulp
158
187
```
159
188
160
-
The default task uses [gulp-angular-templatecache](https://github.com/miickel/gulp-angular-templatecache) to compile all html templates to js and then concatenates and minifies them with the rest of the sources.
189
+
The default task uses
190
+
[gulp-angular-templatecache](https://github.com/miickel/gulp-angular-templatecache) to compile all
191
+
html templates to js and then concatenates and minifies them with the rest of the sources.
161
192
162
193
You can also run `gulp watch` to have it rebuild on change.
163
194
164
195
Tests
165
196
-----
166
-
Unit tests are run with [karma](http://karma-runner.github.io) and written using [mocha](http://visionmedia.github.io/mocha/), [chai](http://chaijs.com/) and [sinon](http://sinonjs.org/)
197
+
Unit tests are run with [karma](http://karma-runner.github.io) and written using
198
+
[mocha](http://visionmedia.github.io/mocha/), [chai](http://chaijs.com/) and
199
+
[sinon](http://sinonjs.org/)
167
200
168
201
To run the tests:
169
202
@@ -178,17 +211,3 @@ $ bower install
178
211
$ sudo npm install -g karma-cli
179
212
$ karma start karma.conf.js
180
213
```
181
-
182
-
Contributing
183
-
------------
184
-
185
-
All contributions are welcome! If its a new field type consider making it an add-on instead,
186
-
especially if it has dependecies. See [extending Schema Form documentation.](docs/extending.md)
187
-
188
-
We're trying to use
189
-
[git flow](http://danielkummer.github.io/git-flow-cheatsheet/), so please base any merge request
190
-
on the **development** branch instead of **master**.
191
-
192
-
Also run any code through the code style checker [jscs](https://github.com/mdevils/node-jscs)
193
-
(or even better use it in your editor) with preset set to `google`. You can also us `gulp jscs` to
0 commit comments