forked from canjs/canjs
-
Notifications
You must be signed in to change notification settings - Fork 1
recipes_livebindings
Josh Dean edited this page Jun 30, 2013
·
3 revisions
@page RecipesLiveBindings Live Bindings @parent Recipes 1
@body
The following recipes show how to use can.EJS's live binding.
The following shows how to create an automatically updating prettyDate
helper for EJS that can be used like:
@codestart <%= prettyDate( new Date() ) %> @codeend
Notice how the created value changes every couple min or so.
The prettyDate method works with or without live-binding. It doesn't need to take
an observe, just a date. Code with EJS becomes live naturally ... amazing.
Learn how to make 2-way binding mustache helpers. When you change the value of an input, it automatically changes the value of an observe. When you change the value of the observe, it changes the value of the input.
<iframe style="width: 100%; height: 300px" src="http://jsfiddle.net/donejs/dffJ7/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0">JSFiddle</iframe>