4

I tried using a parameter in an emit block within a user defined action like this:

my_action = defaction(css_class) {
    emit <| $K(css_class).append("<span>!!</span>"); |>
}

but when that runs you see a console message "css_class is not defined".

How do I set up the parameter so I can use it within the 'emit' block?

Randall Bohn
  • 2,597
  • 2
  • 16
  • 20

1 Answers1

5

There is an environment issue with defactions that is still being resolved. Right now, simply assign a variable to your paramater and your emit will see it. So, something like this:

my_action = defaction(css_class) {
    my_class = css_class;
    emit <| $K(my_class).append("<span>!!</span>"); |>
}
Alex
  • 64,178
  • 48
  • 151
  • 180