英文原文: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}}助手:

  1. {{! ... additional lines truncated for brevity ... }}
  2. {{! ... 为保持代码简洁,在此省略了其他代码 ... }}
  3. <li>
  4. {{#link-to "todos.index" activeClass="selected"}}All{{/link-to}}
  5. </li>
  6. <li>
  7. {{#link-to "todos.active" activeClass="selected"}}Active{{/link-to}}
  8. </li>
  9. <li>
  10. {{#link-to "todos.completed" activeClass="selected"}}Completed{{/link-to}}
  11. </li>
  12. {{! ... additional lines truncated for brevity ... }}
  13. {{! ... 为保持代码简洁,在此省略了其他代码 ... }}

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之间进行切换了。

Live Preview

在线演示

Ember.js • TodoMVC

Additional Resources

附加资源