knockout.js - ko commands Embedded in comment tags? -
i trying understand hottowel more.
in ~/app/views/shell.html, contains:
<header> <!--ko compose: {view: 'nav'} --><!--/ko--> </header> are ko commands embedded within html comment tags? if so, compose command , how argument used?
yes. feature of knockoutjs , it's called "virtual elements". main advantage don't have add additional html tags if it's unnecessary. it's useful , it's clean in scenarios. mentioned in few places in knockout documentation i.e.: http://knockoutjs.com/documentation/with-binding.html , http://knockoutjs.com/documentation/custom-bindings-for-virtual-elements.html
as of compose it's custom binding , explained in hottowel readme:
the
composebindings header , footer hard coded in hot towel pointnav,footerviews, respectively. compose binding section#contentboundroutermodule's active item. in other words, when click navigation link corresponding view loaded in area.
Comments
Post a Comment