admin管理员组文章数量:1357268
I've built small apps in Angular and Ember and have enjoyed working with both-- the structure and functionality of using these frameworks have made coding up the UI a blast!
I was wondering whether there was a way to embed these apps into a pre-existing legacy site? For Angular, I know you can define a target div as your ng-app. Is there a better way of doing this? What about Ember? Are there any issues I need to look out for with regards to patibility/integration?
I realize these frameworks are primarily meant for SPAs but like I said, I really like the opinionated nature and long-term maintainability benefits of using them.
I tried looking online but I haven't found resources regarding this topic (maybe for good reason). Any input would be appreciated.
I've built small apps in Angular and Ember and have enjoyed working with both-- the structure and functionality of using these frameworks have made coding up the UI a blast!
I was wondering whether there was a way to embed these apps into a pre-existing legacy site? For Angular, I know you can define a target div as your ng-app. Is there a better way of doing this? What about Ember? Are there any issues I need to look out for with regards to patibility/integration?
I realize these frameworks are primarily meant for SPAs but like I said, I really like the opinionated nature and long-term maintainability benefits of using them.
I tried looking online but I haven't found resources regarding this topic (maybe for good reason). Any input would be appreciated.
Share Improve this question asked Feb 20, 2014 at 17:17 vegas-devvegas-dev 4034 silver badges8 bronze badges2 Answers
Reset to default 8For ember, the proper way is to insert into an existing div. You can declare the div to insert into when defining your ember app as such:
App = Ember.Application.create({
rootElement: '#divName'
});
For AngularJS you only need to specify where you want the angular part of the code to be piled. By adding:
<div ng-app='MyApplication'></div>
you include the app that you will then import at the end of the index.html file:
<script type='text/javascript' src='myApplication.js'></script>
Then in your application you can create your app and follow the AngularJS module structure from that point on.
var application = angular.module('myApplication', []);
本文标签: javascriptEmbedding EmberAngular apps into preexisting siteStack Overflow
版权声明:本文标题:javascript - Embedding EmberAngular apps into pre-existing site - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744028693a2578511.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论