aurelia-components / examples

examples of different aurelia components usages
0 stars 1 forks source link

parent issue in grid #3

Open dbrezoev opened 8 years ago

dbrezoev commented 8 years ago

button(click.trigger="$item.parent.doSmth($item)" - we did this in order to reach doSmth method from the view model. So every $item has parent property in it.

If doSmth method is declared like this: doSmth = (params) => { do smth } you can access it with:

button(click.trigger="parent.doSmth($item)"

moshensky commented 8 years ago

In custom VM declare method:

export default class MyVMUsingGrid {
  doSmth(item) {
  }
}

In ViewModel - my-vm-using-grid.html

grid...
   grid-row
      grid-col
        button(click.trigger="doSmth($item)"

By default you have access to viewmodel's scope.