Pure AngularJS widgets.
This library provides full pack of pure AngluarJS widgets.
Form bulider builds angular-compatible forms using widgets provided by this library. It supports errors and validations.
<form w-form-for='samurai' ng-submit='send()'>
<div w-field='name' label='Name' type='w-combo' items='names'></div>
<div w-field='age' label='Age' type='w-chz' items='ages'></div>
<div w-submit-field>Save</div>
</form>
Objects errors are extracted from its model passed to wFormFor attribute. It should next format:
{
name: ..., /* this is custom field */
age: ..., /* this is custom field */
/* other custom attrs */,
$error: { /* this is special field */
name: ['Too bad!', 'Ugly!'],
age: ['Too young!']
}
}
### Submiting
For form submitting use `w-submit`. It prevents for submiting if form is invalid.
Function call submit handler SHOULD! update model passed to `w-form-for`.
Example of handler:
$scope.send = function() {
$http.post('/').success(function(data) {
$scope.samurai = data;
});
}
Provides basic select-like input. It allows to select one value from provided values. It has support for ng-model, ng-disabled, ng-required.
Required.
Array of objects: {code: 'some-code', name: 'some-name'}
.
Optional.
Limits number of shown items
. Default: items.length
.
Optional. Attribute for retrieving html id from item. Default: 'id'.
Optional. Attribute for retrieving html label from item. Default: 'label'.
Chosen provides templating for selected object by passing html
template inside directive. You can reference current object by
item
and access all object's attributes.
<div w-chz>
<b>{{item.name}}</b>: {{item.code}}
</div>
For style customization library provides class
for user extention. For styling list define css
class .w-chz .w-chz-items-list
with your own properties.
<div ng-controller='CountriesCtrl'>
<form role="form" class='form-horizontal'>
<div class="form-group">
<label class="col-sm-2 control-label">Chosen</label>
<div class="col-sm-10">
<div w-chz
items="countries"
limit='30'
key-attr='code'
value-attr='name'
ng-model="value"
ng-disabled='disabled'
ng-required='required'>
<b>{{item.name}}</b>: {{item.code}}
</div>
</div>
</div>
</div>
</div>
angular.module('countries').controller('CountriesCtrl', function($scope) {
$scope.countries = [
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'}];
});
Provides basic select-like input. And allows to select multiple values from provided values. It has support for ng-model, ng-disabled, ng-required.
Multiselect has same attributes as a Chosen.
Combo provides basic combo behavior. It allows to select a value from a predefined list of options or to enter custom value. Only primitive types are supported as options. Supports several angular directives: ng-model, ng-disabled, ng-required.
Required.
Array of items. toString
will be called on item when retrieving it
from list.
Optional.
Limits number of shown items
. Default: items.length
.
Combo provides templating for selected object by passing html
template inside directive. You can reference current object by
item
.
<div w-combo>
<b>{{item}}</b>
</div>
Provides basic combo-like input and allows to select multiple values from provided values. It has support for ng-model, ng-disabled, ng-required.
Multiselect has only items and limit attributes.
- Form builder.
- ng-options support.
- Make demo github pages.
- I18n.
- Add ability for customizing Chosen style (added for list).
- Different search algorithms.
- Delegate id and name to input.
- Fully remove jQuery.
- Add select option, for providing selected value.
- Support array of primitives.
- Same as in Chosen.
- Add options for limiting number (min, max) of selected values.
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
Then follow the instructions.
NOTE: This script adds nvm
command to .bash_profile
. It may not work if you are using not bash
shell
(like zsh
). In this case you have to manually configure profile file.
nvm install 0.10
cd /path/to/ng-w
npm install
Then build it at first time:
`npm bin`/grunt build
Then start watching changes:
`npm bin`/grunt watch
To run demo:
node server.js
You can specify port as a second first argument:
node server.js 3000
Default port is 17405.
If The program 'npm' is currently not installed.
Then try nvm use 0.10
.