data-bind
attribute and specify a value for compose
. e.g. data-bind=compose: 'file/path'
compose
is a custom binding for Knockoutnavbar.html
. Partial views have no matching JavaScript file, and are stored in the views
folder. If you bind a partial without a viewmodel, it’ll bind it to the parent element’s viewmodel.1<section data-bind="compose: 'navbar.html'"></section>
2<!-- just HTML, no JS involved -->
3
4<section data-bind="compose: 'viewmodels/navbar'"></section>
5<!-- get the viewmodel and the matching view, bind them together and insert into DOM -->