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
太烦人了!好找的人,花了一个小时试图弄清楚这一点。 –