admin管理员组文章数量:1394987
I know that ember js is good for single page apps and it appears that you can localize ember js app to a single dom container rather than the whole page, so I'm wondering if ember js would be a good fit for advanced widget creation, not just a slightly fancy drop down or anything but a more plex widget which may deal with its own restful resource etc. Or is using ember.js in this way overkill?
If it is suitable for widgets, would it be possible without having to recode the widgets to use multiple ember widget apps on the same page when the ember apps have e from different authors, an example of what I mean is that I can easily have multple jquery plugins from different sources on the same page without any conflicts.
I know that ember js is good for single page apps and it appears that you can localize ember js app to a single dom container rather than the whole page, so I'm wondering if ember js would be a good fit for advanced widget creation, not just a slightly fancy drop down or anything but a more plex widget which may deal with its own restful resource etc. Or is using ember.js in this way overkill?
If it is suitable for widgets, would it be possible without having to recode the widgets to use multiple ember widget apps on the same page when the ember apps have e from different authors, an example of what I mean is that I can easily have multple jquery plugins from different sources on the same page without any conflicts.
Share Improve this question edited Dec 14, 2011 at 17:59 n0p 74312 silver badges25 bronze badges asked Dec 14, 2011 at 17:38 Gibb SonnGibb Sonn 4591 gold badge5 silver badges12 bronze badges 1- Looks related to stackoverflow./questions/11571896/… – jacobq Commented Sep 27, 2012 at 20:18
1 Answer
Reset to default 10Ember.js would not be overkill for plex widgets and it's pletely possible to use multiple ember widget apps on a single page. However, there will need to be a little code modification. From the Ember.js code:
"By default, Ember.Application will begin listening for events on the document. If your application is embedded inside a page, instead of controlling the entire document, you can specify which DOM element to attach to by setting the
rootElement
property:
MyApp = Ember.Application.create({
rootElement: $('#my-app')
});
The root of an Ember.Application must not be removed during the course of the page's lifetime. If you have only a single conceptual application for the entire page, and are not embedding any third-party Ember applications in your page, use the default document root for your application.
You only need to specify the root if your page contains multiple instances of Ember.Application."
Now the obvious issue would be how to set rootElement for each of these widgets before it's JavaScript is loaded. I can think of a number of ways of doing this but the best way depends on the setup of whatever you're trying to do. Hopefully this puts you on the correct path.
本文标签: javascriptemberjs widgetsStack Overflow
版权声明:本文标题:javascript - ember.js widgets - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744110010a2591246.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论