i want create one div ( basically it will containt listbox) , and i want to use the div in different pages,
which is the best option to use in duarandal.js?
Composition
http://durandaljs.com/documentation/Using-Composition/
Widget
http://durandaljs.com/documentation/Creating-A-Widget/
In general, think of using the compose
binding as templates, and widgets as user controls
There's not quite enough information in your question for me to offer a suggestion on which is the right choice for you, but I'll provide some comparison for the two below, which should make it easier for you to choose.
The compose binding is most useful when you have a view and/or view model that can be used as is in multiple places.
Durandal's widgets, on the other hand, use composition internally, but are designed to abstract the "parts" of the widget so that one widget can be configured differently on each view where it is rendered. A widget can have parts
, and these parts can be exposed through the widget interface.
Durandal widgets are most useful when you want to create some functionality that can be used across multiple views, but the implementations may differ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With