简体   繁体   English

如何在现有的html中使用ember

[英]How to Use ember in a existing html

I am looking to use Ember 2.0 in an existing HTML page and have a few questions related to that. 我希望在现有的HTML页面中使用Ember 2.0,并且有一些与此相关的问题。

  1. Do I need to first build the ember project? 我需要先构建ember项目吗? This process creates appname.js and vendor.js. 此过程将创建appname.js和vendor.js。
  2. What js files should I include in the existing html? 我应该在现有的html中包括哪些js文件?
  3. How do I make the existing html page load the ember application? 如何使现有的html页面加载ember应用程序? I looked at Link to JSFiddle http://jsfiddle.net/vAxkL/11/ which works well for Ember V1 but does not work with Ember 2.0 我看过Link to JSFiddle http://jsfiddle.net/vAxkL/11/ ,该Link to JSFiddle对Ember V1效果很好,但不适用于Ember 2.0

Thank you for your help 谢谢您的帮助

Here is the updated fiddle using the latest ember. 这是使用最新余烬的更新小提琴。

Code wise not much changes. 代码明智的变化不大。 The required files to include are different and array controllers are not deprecated. 所需的文件有所不同,并且不建议使用阵列控制器。

  1. You do not need to build the ember project unless you want to deploy for production. 除非您要进行生产部署,否则无需构建ember项目。 You can just include the relevant js files and you will good to do. 您可以只包含相关的js文件,您会做得很好。 You can check the above demo to see what all is included and how its used. 您可以查看上面的演示,以查看其中包含的所有内容及其用法。

  2. You will need to include the latest ember-template-compiler.js and ember.js . 您将需要包括最新的ember-template-compiler.jsember.js

  3. Check the above link to see your fiddle updated to work for Ember 2. 检查上面的链接,以查看您的小提琴已更新为适用于Ember 2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM