英文原文:http://emberjs.com/guides/getting-started/show-all-todos-again/
Next we can update the application to allow navigating back to the list of all todos.
接下来我们将对应用进行进一步的修改,使得用户可以查看所有待办事项。
In index.html
convert the <a>
tag for ‘All’ todos into a Handlebars {{link-to}}
helper:
在index.html
中,将‘全部’待办事项的<a>
标签改为Handlebars的{{link-to}}
助手:
{{! ... additional lines truncated for brevity ... }}
{{! ... 为保持代码简洁,在此省略了其他代码 ... }}
<li>
{{#link-to "todos.index" activeClass="selected"}}All{{/link-to}}
</li>
<li>
{{#link-to "todos.active" activeClass="selected"}}Active{{/link-to}}
</li>
<li>
{{#link-to "todos.completed" activeClass="selected"}}Completed{{/link-to}}
</li>
{{! ... additional lines truncated for brevity ... }}
{{! ... 为保持代码简洁,在此省略了其他代码 ... }}
Reload your web browser to ensure that there are no errors. You should be able to navigate between urls for all, active, and completed todos.
重载浏览器确保没有任何错误。现在应该可以在不同状态(全部、活动和已完成)的待办事项的URL之间进行切换了。