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-35Lines changed: 50 additions & 35 deletions
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.
@@ -67,11 +74,6 @@ Then load them into Schema Form using the `sfSchema`, `sfForm`, and `sfModel` di
67
74
</div>
68
75
```
69
76
70
-
When you are done downloading all the [dependecies](#dependencies) and project files the only remaining part is to add dependencies on the `'schemaForm'` AngularJS module:
71
-
72
-
```javascript
73
-
angular.module('myModule', ['schemaForm']);
74
-
```
75
77
76
78
Documentation
77
79
-------------
@@ -137,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.
148
172
149
-
Your can also [create your own add-ons.](docs/extending.md)
150
173
151
174
Building
152
175
--------
153
-
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/).
154
178
155
-
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.
156
181
157
182
```bash
158
183
$ npm install
@@ -161,13 +186,17 @@ $ bower install
161
186
$ gulp
162
187
```
163
188
164
-
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.
165
192
166
193
You can also run `gulp watch` to have it rebuild on change.
167
194
168
195
Tests
169
196
-----
170
-
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/)
171
200
172
201
To run the tests:
173
202
@@ -182,17 +211,3 @@ $ bower install
182
211
$ sudo npm install -g karma-cli
183
212
$ karma start karma.conf.js
184
213
```
185
-
186
-
Contributing
187
-
------------
188
-
189
-
All contributions are welcome! If its a new field type consider making it an add-on instead,
190
-
especially if it has dependecies. See [extending Schema Form documentation.](docs/extending.md)
191
-
192
-
We're trying to use
193
-
[git flow](http://danielkummer.github.io/git-flow-cheatsheet/), so please base any merge request
194
-
on the **development** branch instead of **master**.
195
-
196
-
Also run any code through the code style checker [jscs](https://github.com/mdevils/node-jscs)
197
-
(or even better use it in your editor) with preset set to `google`. You can also us `gulp jscs` to
0 commit comments