엠버 응용 프로그램을 설정하려고하는데 이상한 동작이 나타납니다. 두 개의 라우트가 설정되었습니다. "환영"은 "/"에 매핑됩니다. 및 "기능"으로 매핑되며 "기능"에 매핑됩니다. "/"로 이동하면 시작 템플릿이 올바르게 렌더링됩니다. 그러나 "/ features"로 이동하면 여전히 환영 템플릿이 렌더링됩니다.Ember가 루트 템플릿 만 렌더링합니다.
이 jsbin은 실제로 올바르게 작동합니다 : http://jsbin.com/OSoFeYe/1,하지만 내 응용 프로그램의 아래 코드는 그렇지 않습니다.
App.Router.map(function() {
this.route("welcome", {path: "/"});
this.resource("features", {path: "/features"}, function() {
this.route("new");
});
});
App.FeaturesIndexRoute = Ember.Route.extend({
});
<body>
<div class="container">
<script type="text/x-handlebars">
<h1>rendered application template</h1>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="features">
<h2>Render features</h2>
<h6>Done features template</h6>
</script>
<script type="text/x-handlebars" data-template-name="welcome">
<h2>Render welcome</h2>
</script>
</div>
</body>
이 문제점에 대한 통찰력을 얻으실 수 있습니다.
따라서 기능은 "http : // localhost : 3000/features #/features"링크를 링크하고 기능 템플리트를 올바르게 렌더링합니다. 그러나 "http : // localhost : 3000/features"로 이동하면 여전히 환영 템플릿이 렌더링됩니다. –