computeData
function
scope.computeData(key)
Parameters
- key
{can-mustache.key}:A dot seperated path. Use
"."if you have a property name that includes a dot. - options
{can-view-scope.readOptions}:Options that configure how the
keygets read.
Returns
{Object}:
An object with the following values:
Use
scope.computeData(key, options) is used heavily by [can-mustache] to get the value of
a [can-mustache.key key] value in a template. Configure how it reads values in the
scope and what values it returns with the [can-view-scope.readOptions options] argument.
var context = new Map({
name: {first: "Curtis"}
})
var scope = new Scope(context)
var computeData = scope.computeData("name.first");
computeData.scope === scope //-> true
computeData.initialValue //-> "Curtis"
computeData.compute() //-> "Curtis"
The compute value is writable. For example:
computeData.compute("Andy")
context.attr("name.first") //-> "Andy"