Bindings

Bindings define how our HTML displays and reacts to our Javascript. Falcon adds new bindings to Knockout, the most important being the 'view' binding.

view data-bind="view: my_view_property"

Method used to handle Falcon.View obects. This will handle fetching a view's viewmodel and html template. This method expects to use the native Knockout templating engine.

1 var MyView = Falcon.View.extend({url: '#my_view_template'});
2 Falcon.apply({my_view: new MyView()}, '#application');
Application Javascript
1 <div id="application">
2 	Who's View is this?!
3 	<br />
4 	<!-- ko view: my_view --><!-- /ko -->
5 </div>
6 <template id="my_view_template">
7 	This is my View!
8 </template>
Application HTML
1 Who's View is this?!
2 This is my View!
On-screen rendered output
foreach

This is the same as the Knockout's Foreach binding except that it has been modified to handle Falcon Collection's as well

1 var Dogs = Falcon.Collection.extend({ ... });
2 
3 Falcon.apply({
4 	dogs: new Dogs(),
5 	cats: ko.observableArray([])
6 }, '#application');
Application Javascript
1 <div id="application">
2 	<div data-bind="foreach: dogs"> ... A List of Dogs ...</div>
3 	<div data-bind="foreach: cats"> ... A List of Cats ...</div>
4 </div>
Application HTML
log

This is a helper binding that can be used to dump whatever is passed into it, into the browser console. Useful for debugging and understanding context

1 var hello_world = ko.observable("Hello World");
Application Javascript
1 <!-- ko log: hello_world --><!-- /ko -->
Application HTML
1 => Hello World
Console Output
options

This is the same as the Knockout's Options binding except that it has been modified to handle Falcon Collection's as well.