1
1
## Formly
2
2
Formly for Angular is an AngularJS module which has directives to help customize and render JSON based forms. The directive originated from a need to allow our users to create surveys and distribute them easily. Currently we've can render the form data from JSON and assign a model to form so we can receive the submitted data.
3
3
4
- <formly-form result="formData" fields="formFields" options="formOptions" ng-submit="onSubmit()">
5
- </formly-form>
4
+ <formly-form result =" formData " fields =" formFields " options =" formOptions " ng-submit =" onSubmit() " >
5
+ </formly-form >
6
6
7
7
### Demo : http://Nimbly.github.io/angular-formly/
8
8
9
9
## Dependencies
10
- - required:
11
- [TODO]
12
- - optional
13
- [TODO]
10
+ - Required to use Formly:
11
+ - Angular
12
+ - Twitter Bootstrap
13
+
14
+ - Dev dependencies to build Formly
15
+ - npm
16
+
14
17
15
18
See ` bower.json ` and ` index.html ` in the ` master ` branch for a full list / more details
16
19
17
20
## Install in your project
18
- 1 . download the files
19
- 1. Bower
20
- 1. run `bower install angular-formly`
21
- 2 . include the files in your app
22
- 1. `bower_components/angular-formly/dist/formly.min.js`
23
- 3 . include the module in angular (i.e. in ` app.js ` ) - ` formly `
24
- `var app = angular.module('app', ['ng', 'ui.router', 'formly']);`
21
+ 1 . Install with Bower
22
+ ` $ bower install angular-formly `
23
+
24
+ 2 . Include the files in your index.html
25
+ ` <script src="bower_components/angular-formly/dist/formly.min.js"></script> `
26
+
27
+ 3 . Add 'formly' as a required module to your angular app, usually in ` app.js ` :
28
+ ` var app = angular.module('app', ['ng', 'ui.router', 'formly']); `
25
29
26
30
## Documentation
27
- [ TODO]
31
+
32
+ ``` html
33
+ <formly-form result =" formData" fields =" formFields" options =" formOptions" ng-submit =" onSubmit()" >
34
+ </formly-form >
35
+ ```
36
+
37
+ For options specific to input types see their directive html in ` src/directives `
38
+ ``` javascript
39
+ var formFields = [
40
+ {
41
+ // the key to be used in the result values {... "username": "johndoe" ... }
42
+ key: ' username' ,
43
+
44
+ // default value
45
+ default: ' uberuser'
46
+ type: ' text' ,
47
+ label: ' Username' ,
48
+ placeholder: ' johndoe' ,
49
+ required: true ,
50
+ disabled: false , // default: false
51
+ },
52
+ {
53
+ key: ' password'
54
+ type: ' password' ,
55
+ label: ' Password' ,
56
+ required: true ,
57
+ disabled: false , // default: false
58
+ }
59
+
60
+ ];
61
+
62
+ var formOptions = {
63
+
64
+ // Set the id of the form
65
+ uniqueFormId: ' myFormId' ,
66
+
67
+ // Hide the submit button that is added automaticaly
68
+ // default: false
69
+ hideSubmit: false ,
70
+
71
+ // Set the text on the default submit button
72
+ // default: Submit
73
+ submitCopy: ' Login'
74
+ };
75
+ ```
28
76
29
77
## Roadmap
30
78
@@ -33,12 +81,12 @@ See `bower.json` and `index.html` in the `master` branch for a full list / more
33
81
## Development
34
82
35
83
1 . ` git checkout master `
36
- 1. run `npm install && bower install`
37
- 2. test your code using `grunt dev` which hosts the app at `http://localhost:4000`
38
- 3. commit your changes
84
+ 1 . run ` npm install && bower install `
85
+ 2 . test your code using ` grunt dev ` which hosts the app at ` http://localhost:4000 `
86
+ 3 . commit your changes
39
87
3 . update README, CHANGELOG, bower.json, and do any other final polishing to prepare for publishing
40
- 1. git commit changes
88
+ 1 . git commit changes
41
89
42
90
## Grunt targets
43
- * ` grunt dev ` : Creates a server for testing at ` http://localhost:400 `
91
+ * ` grunt dev ` : Creates a server for testing at ` http://0.0.0.0:4000 `
44
92
* ` grunt publish ` : Copies the src folder and bower_components to gh-pages
0 commit comments