Skip to content

Instantly share code, notes, and snippets.

@danott
Created June 10, 2014 22:09
Show Gist options
  • Save danott/842fec3b53a33a2bc88a to your computer and use it in GitHub Desktop.
Save danott/842fec3b53a33a2bc88a to your computer and use it in GitHub Desktop.
# required on jsbin
Batman.config.usePushState = false
simpleStore = new Batman.Set()
simpleStore.add new Batman.Object({name: "Red"})
simpleStore.add new Batman.Object({name: "Green"})
simpleStore.add new Batman.Object({name: "Blue"})
class App extends Batman.App
@root "colors#index"
class App.ColorsController extends Batman.Controller
routingKey: 'colors'
index: ->
@set('colors', simpleStore)
App.run()
<!DOCTYPE html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/batman.js/0.16.0/batman.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div data-yield="main"></div>
<div data-defineview="colors/index">
<div data-foreach-color="colors">
<a data-bind="color.name"></a>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment