3
我在Ember應用程序中有一個名爲「basic」的路由,對應於API端點的名稱。在Ember中是「基本」保留路線名稱嗎?
此路線不起作用 - 指向它的鏈接不呈現其模板。
這裏有一個JSBin證明了失敗:http://emberjs.jsbin.com/hisoxadi/1
JS:
App = Ember.Application.create();
App.Router.map(function() {
this.route('basic');
this.route('test');
});
App.IndexRoute = Ember.Route.extend({
model: function() {
return ['red', 'yellow', 'blue'];
}
});
模板:
<script type="text/x-handlebars">
<h2> Welcome to Ember.js</h2>
{{#link-to 'index'}}Index{{/link-to}}
{{#link-to 'basic'}}Basic Route{{/link-to}}
{{#link-to 'test'}}Test Route{{/link-to}}
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="basic">
basic route is here
</script>
<script type="text/x-handlebars" data-template-name="test">
test route is here
</script>
<script type="text/x-handlebars" data-template-name="index">
<ul>
{{#each item in model}}
<li>{{item}}</li>
{{/each}}
</ul>
</script>
透過Ember的消息來源,我可以看到所有的地方都提到了基本的東西。在討論路線時,它應該在文檔中基本上是保留關鍵字。 – bcmcfc
太煩人了!好找的人,花了一個小時試圖弄清楚這一點。 –