leonidas/transparency — Issue #28: Support for append, prepend and other manipulations
Author: pyykkis
Created: 2012-03-07 06:44:24+00:00
State: open
Labels: Feature

Sometimes, it's useful to manipulate existing value with directives, instead of replacing it, e.g., adding an `even` or `odd` class for a list item. A flexible support for the use case could be provided by allowing the value to be a function and providing the current value as a parameter.

```html

```

```coffeescript
data = [
name: "Foo"
, bar: "Bar"
]

directives =
name: (element, i) ->
text: @name
class: (attr) -> if i % 2 then attr + " odd" else attr + " even"

$("#list").render data, directives
```