如何控制Ember.js附加渲染应用程序模板的位置? [英] How do I control where Ember.js appends the rendered application template?

查看:121
本文介绍了如何控制Ember.js附加渲染应用程序模板的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的Ember应用程序切换到使用Ember.Router,但是在应用程序模板附加的位置出现问题。当我调用App.initialize()它会在文档的末尾呈现模板。有没有办法指定渲染的应用程序模板附加到哪里?

I'm trying to switch my Ember application over to using the Ember.Router but am having an issue with where the application template gets appended. When I call App.initialize() it renders the template at the end of the document. Is there a way to specify where the rendered application template gets appended to?

我的应用程序是一个rails应用程序,我正在尝试将Ember应用程序嵌入到我的一个页面。我不想改变我现在的页眉和页脚呈现的方式,所以我最好能指定ember渲染模板的位置。

My application is a rails app and I'm trying to embed an Ember application on one of my pages. I don't want to change the way my current header and footer gets rendered so ideally I would be able to specify where ember renders the template.

这是一个 jsfiddle 示例。您可以看到它呈现:

Here is a jsfiddle example. You can see that it renders:


Header Content 
Footer Content 
Test 1 
Test 2 
Test 3

我正在尝试的是:


Header Content
Test 1
Test 2
Test 3
Footer Content


推荐答案

设置 Ember.Application rootElement http://jsfiddle.net/vAxkL/3/

文件: http://docs.emberjs.com/symbols/Ember .Application.html

编辑 - 通过锚定到1.0.pre版本修复了小提琴: http://jsfiddle.net/vAxkL/11/

EDIT -- Fixed the fiddle by anchoring to the 1.0.pre version: http://jsfiddle.net/vAxkL/11/

这篇关于如何控制Ember.js附加渲染应用程序模板的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆