Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
Vlad Balin committed Feb 17, 2016
2 parents 4212e96 + 91b86bb commit 7e96f01
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
node_modules
*.orig
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ is the perfect abstraction to isolate data binding details from the UI control l
You can create link for any property of the state, as well as for any model.

`const link = object.getLink( 'attr' )`
`const link = object.deepLink( 'path.to.the.attribute' )`

Or, you can create boolean link, toggling model in collection. `true` if model is contained in collection, assignments will add/remove given model. Useful for checkboxes.
`const link = collection.hasLink( model )`
Expand Down
6 changes: 4 additions & 2 deletions example/databinding.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,15 @@ Standard `<input>` will work. You may implement custom input controls to handle
with validation and appearance.

```javascript
const Input = ({ valueLink, ...props }) => (
const Input = ({ valueLink, className, ...props }) => (
<div className='wrapping'
<input {...props} value={ valueLink.value } onChange={ e => valueLink.set( e.target.value ) }/>
<input className={ className + ( valieLink.error ? ' error' : '' ) } {...props} value={ valueLink.value } onChange={ e => valueLink.set( e.target.value ) }/>
</div>
);
```

Errors are attached to the links automatically, when model validation is failed. Validation checks can be attached to model attributes with `.has.check` specification. `x : Number.has.check( x => x > 0 )`, `y : Number.has.check( x => x < 0, 'y should be negative' )`.

### Binding to model attributes

```javascript
Expand Down

0 comments on commit 7e96f01

Please sign in to comment.