Skip to content

Commit 96c35e8

Browse files
committed
Initial commit
0 parents  commit 96c35e8

4 files changed

Lines changed: 75 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

bower.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "fng-select2",
3+
"version": "0.4.0-alpha.1",
4+
"authors": [
5+
"Mark Chapman <mark.chapman@gmail.com>"
6+
],
7+
"description": "select2 plugin for forms-angular. Doesn't do anything apart from drag in components.",
8+
"main": "",
9+
"keywords": [
10+
"forms-angular"
11+
],
12+
"license": "MIT",
13+
"homepage": "www.forms-angular.org",
14+
"dependencies": {
15+
"jquery": ">=1.8",
16+
"angular-ui-select2": "0.0.4",
17+
"select2": "3.4.3",
18+
"select2-bootstrap-css": "~1.3"
19+
},
20+
"ignore": [
21+
"**/.*",
22+
"node_modules",
23+
"bower_components",
24+
"test",
25+
"tests"
26+
]
27+
}

license.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2014 Mark Chapman
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

readme.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# fng-select2
2+
3+
Plugin for forms-angular that adds select2 support.
4+
5+
## Usage
6+
7+
bower install fng-select2
8+
9+
Add the following lines to your index.html (or equivalent) file
10+
11+
<link rel="stylesheet" href="/bower_components/select2/select2.css">
12+
<script src="/bower_components/jquery/jquery.js"></script>
13+
<script src="/bower_components/angular-ui-select2/src/select2.js"></script>
14+
<script src="/bower_components/select2/select2.js"></script>
15+
16+
In your Mongoose schemas you can set up fields like this:
17+
18+
colour: {type: String, enum: ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'], form:{select2:true}}
19+
lookup: { type: Schema.Types.ObjectId, ref: 'anotherModel', form: {select2: {}}},
20+
21+
In this case forms-angular will look up all the values in the anotherModel collection when the form is loaded. In the
22+
case where the collection is large you should use the fngAjax option
23+
24+
lookup2: { type: Schema.Types.ObjectId, ref: 'largeModel', form: {select2: {fngAjax:true}}}
25+
26+
which instructs the program to use ajax calls to query the server rather than downloading the table.
27+

0 commit comments

Comments
 (0)