Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. KnockoutJS calling methods with context in bindings
  2. <div data-bind="foreach: someData1">
  3.     <a href="#" data-bind="click: myFunction"></a>
  4. </div>
  5.  
  6. <div data-bind="foreach: someData2">
  7.     <a href="#" data-bind="click: myFunction"></a>
  8. </div>
  9.        
  10. viewModel.myFunction = function (item, event) {
  11.   // event.target = <a>
  12. };