Ember.js 入门指南——handlebars显示对象的键(未完待续)

来源:互联网 发布:google 高程提取软件 编辑:程序博客网 时间:2024/05/20 04:15

  在实际的开发过程中你很有可能需要显示出对象数组的键或者值,如果你需要同时显示出对象的键和值你可以使用{{#each-in}}标签。

准备工作:使用Ember CLI生成一个component,与此同时会生成一个对应的模板文件。

ember generate component store-categories

执行上述命令得到下面的3个文件:

app/components/store-categories.jsapp/templates/components/store-categories.hbstests/integration/components/store-categories-test.js

然后在app/router.js增加一个路由设置,在map方法里添加“this.route('store-categories');”;此时可以直接访问http://localhost:4200/store-categories;

 

http://guides.emberjs.com/v2.0.0/templates/displaying-the-keys-in-an-object/

这一节还不知道怎么回事就是不出结果,待到后面学习了component在回头补上!!!

0 0
原创粉丝点击