can-stache-bindings
Advanced tools
Comparing version 3.4.4 to 3.4.5
@@ -58,2 +58,4 @@ @module can-stache-bindings | ||
> __Note:__ If value being passed to the component is an object, changes to the objects properties will still be visible to the component. Objects are passed by reference. See [can-stache-bindings#OneWayBindingWithObjects One Way Binding With Objects]. | ||
#### [can-stache-bindings.toParent one-way to parent] | ||
@@ -75,2 +77,4 @@ | ||
> __Note:__ If value being passed to the component is an object, changes to the objects properties will still be visible to the component. Objects are passed by reference. See [can-stache-bindings#OneWayBindingWithObjects One Way Binding With Objects]. | ||
#### [can-stache-bindings.twoWay two-way] | ||
@@ -90,1 +94,24 @@ | ||
``` | ||
## One Way Binding With Objects | ||
`{child-prop}="key"` ([can-stache-bindings.toChild one-way to child]) or `{^child-prop}="key"` ([can-stache-bindings.toParent one-way to parent]) is used to pass values from the current scope to a component or vice versa, respectively. | ||
Generally, this binding only observes changes in one direction, but when [can-stache.key] is an object (POJO, DefineMap, etc), it is passed as a reference, behaving in much the same way as the following snippet. | ||
```javascript | ||
function component(bar) { | ||
// changes to bar's properties are preserved | ||
bar.quux = 'barfoo'; | ||
// but replacing bar is not | ||
bar = { | ||
quux: 'hello world' | ||
}; | ||
} | ||
var foo = { | ||
quux: 'foobar' | ||
}; | ||
component(foo); | ||
``` |
@@ -14,2 +14,4 @@ @function can-stache-bindings.toChild {to-child} | ||
> __Note:__ If [can-stache.key] is an object, changes to the objects properties will still be visible to the component. Objects are passed by reference. See [can-stache-bindings#OneWayBindingWithObjects One Way Binding With Objects]. | ||
@param {String} child-prop The name of the property to set in the | ||
@@ -16,0 +18,0 @@ component’s viewmodel. |
@@ -15,2 +15,4 @@ @function can-stache-bindings.toParent {^to-parent} | ||
> __Note:__ If [can-stache.key] is an object, changes to the objects properties will still be visible to the component. Objects are passed by reference. See [can-stache-bindings#OneWayBindingWithObjects One Way Binding With Objects]. | ||
@param {String} child-prop The name of the property to export from the | ||
@@ -17,0 +19,0 @@ child components viewmodel. Use `{^this}` or `{^.}` to export the entire viewModel. |
{ | ||
"name": "can-stache-bindings", | ||
"version": "3.4.4", | ||
"version": "3.4.5", | ||
"description": "Default binding syntaxes for can-stache", | ||
@@ -39,3 +39,3 @@ "homepage": "http://canjs.com", | ||
"can-event-dom-radiochange": "^1.0.0", | ||
"can-observation": "^3.3.0-pre.1", | ||
"can-observation": "^3.3.1", | ||
"can-reflect": "^1.2.1", | ||
@@ -64,4 +64,4 @@ "can-simple-map": "^3.3.0-pre.2", | ||
"steal-tools": "^1.1.2", | ||
"testee": "^0.6.1" | ||
"testee": "^0.7.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171887
Updatedcan-observation@^3.3.1