What is the origin and purpose of the variable $data in KnockoutJS?

前端 未结 3 803
一向
一向 2020-12-24 04:31

In the KnockoutJS tutorials I stumbled upon the following code example that contains an unexplainable variable $data.

The View (html):



        
3条回答
  •  情歌与酒
    2020-12-24 05:15

    $data is part of Knockout's Binding Contexts.

    Here are all the built-in variables:

    • $parent
    • $parents
    • $root
    • $component
    • $data
    • $index (only available within foreach bindings)
    • $parentContext
    • $rawData
    • $componentTemplateNodes

提交回复
热议问题