admin管理员组文章数量:1278823
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
/
Widget
/
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./documentation/Using-Composition/
Widget
http://durandaljs./documentation/Creating-A-Widget/
Share Improve this question edited Aug 19, 2013 at 14:41 patel asked Aug 19, 2013 at 14:34 patelpatel 6355 gold badges24 silver badges40 bronze badges1 Answer
Reset to default 14In general, think of using the pose
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 parison for the two below, which should make it easier for you to choose.
Durandal's pose binding can be used to render, or inject, one view as part of another. For example, a menu.html may be defined that can be used to display menu items. This is similar to the concept of a jQuery template, or a "partial view" in ASP.Net MVC. A posed view can either use the parent's view model as its data source, or it can have its own view model.
The pose 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 position 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.
本文标签: javascriptDurandaljscomposition vs widgetStack Overflow
版权声明:本文标题:javascript - Durandal.js - composition vs widget - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741242024a2364167.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论