-
-
Save jaehess/1791066 to your computer and use it in GitHub Desktop.
batman.js checkbox example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test App</title> | |
<script type="text/javascript" src="../lib/es5-shim.js"></script> | |
<script type="text/javascript" src="../lib/batman.js"></script> | |
<script type="text/javascript" src="../lib/batman.solo.js"></script> | |
<script type="text/javascript" src="../lib/extras/batman.rails.js"></script> | |
<script type="text/javascript" src="../lib/coffee-script.js"></script> | |
</head> | |
<body> | |
<ul> | |
<li data-foreach-contact="controllers.app.contacts"> | |
<label class="checkbox"> | |
<input type="checkbox" data-bind="contact.isShowing"> | |
<span data-bind="contact.name"></span> | |
</label> | |
</li> | |
</ul> | |
<div data-foreach-contact="controllers.app.contacts" data-showif="contact.isShowing" data-bind="contact.name"></div> | |
<script type="text/coffeescript"> | |
class App extends Batman.App | |
@global yes | |
@root 'app#index' | |
class App.Contact extends Batman.Model | |
class App.AppController extends Batman.Controller | |
index: -> | |
c1 = new App.Contact(name: 'a') | |
c2 = new App.Contact(name: 'b') | |
@set 'contacts', new Batman.Set(c1, c2) | |
@render false | |
App.run() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment