Skip to content

Commit 7e96f01

Browse files
author
Vlad Balin
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # README.md
2 parents 4212e96 + 91b86bb commit 7e96f01

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
22
node_modules
3+
*.orig

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ is the perfect abstraction to isolate data binding details from the UI control l
214214
You can create link for any property of the state, as well as for any model.
215215

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

218219
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.
219220
`const link = collection.hasLink( model )`

example/databinding.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@ Standard `<input>` will work. You may implement custom input controls to handle
153153
with validation and appearance.
154154

155155
```javascript
156-
const Input = ({ valueLink, ...props }) => (
156+
const Input = ({ valueLink, className, ...props }) => (
157157
<div className='wrapping'
158-
<input {...props} value={ valueLink.value } onChange={ e => valueLink.set( e.target.value ) }/>
158+
<input className={ className + ( valieLink.error ? ' error' : '' ) } {...props} value={ valueLink.value } onChange={ e => valueLink.set( e.target.value ) }/>
159159
</div>
160160
);
161161
```
162162

163+
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' )`.
164+
163165
### Binding to model attributes
164166

165167
```javascript

0 commit comments

Comments
 (0)