blue-sky
blue-sky

Reputation: 53896

How are parameters passed to knockout functions?

For this binding :

<a data-bind='click: $root.thisValue '>

The corresponding knockout function takes a 'link' as a parameter :

this.thisValue = function(link) {   

How is the 'link' parameter set ? It does'nt seem to be set within the data binding ?

Upvotes: 2

Views: 112

Answers (1)

Anders
Anders

Reputation: 17564

its not the element, its the data context associated with the element

http://jsfiddle.net/FpYkS/

ViewModel = function() {
    this.data = "data";        
}

ViewModel.prototype = {
    handle: function(item) {
        console.log(item.data);
    }
};

Upvotes: 2

Related Questions