markevans/onionjs — pull request #2 by pablobm (2013-05-30 16:29:47+00:00)
Title: App can be started at any part of the DOM

Sometimes you want the app to be in a place different than the default `div#app`. These options give you finer-grained control. Examples follow.

### Default behaviour

```Ruby
<%= onionjs_app('studio_calendar', preloaded_data) %>
```

Prints out `

` and renders the app there. This is for compatibility with the old helper.

### `:id` parameter

```Ruby
<%= onionjs_app('studio_calendar', preloaded_data, id: 'here') %>
```

Prints out `

` and renders the app there.

### `:base` parameter

```Ruby
<%= onionjs_app('studio_calendar', preloaded_data, base: '.here') %>
```

Does not print out anything. Expects an element with the given selector (`.here` in the example) to exist, and renders the app there.

### Notes

* This feature is particularly useful when using "progressive views" (will come in a different pull request), as it allows us to anchor the app on the `

` tag from where it can access the whole page.

* In case of conflict, `:base` trumps `:id`.