이렇게하려면 ember-cli-rails를 사용할 수 있습니다.
엠버 응용 프로그램을 특정 경로에 마운트하도록 레일을 구성 할 수 있습니다.
# config/routes.rb
Rails.application.routes.draw do
mount_ember_app :frontend, to: "/ember"
end
원하는 경우 나머지 레일과 동일한 레일 레이아웃을 사용하고 특정 요소에서만 엠버를 렌더링 할 수도 있습니다.
<%# app/views/posts/index.html.erb %>
<div id="ember-application"></div>
<%= include_ember_script_tags :frontend %>
<%= include_ember_stylesheet_tags :frontend %>
트릭은 엠 측에 설정/environment.js에 rootElement
를 설정하는 것이다.
/* frontend/config/environment.js */
/* eslint-env node */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'frontend',
environment: environment,
baseURL: '/',
locationType: 'auto',
//locationType: 'none',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
rootElement: '#ember-application'
},
더 이상 도움이 필요하면 알려주세요.