如何查看手柄模板中的所有可用变量 [英] How to see all available variables in handlebars template

查看:106
本文介绍了如何查看手柄模板中的所有可用变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事我的第一个Ember.js应用程序,并且连接所有的点都有麻烦。如果我可以看到给定的handlebars模板中可用的所有变量,这将是非常有帮助的。



有一个相关的问题,但是你必须知道在使用范围内:
如何在Handlebars模板中添加console.log()JavaScript逻辑?



如何输出 所有 变量?

解决方案

确保你尝试Firebug - 你会得到一个不同的对事物的看法,我觉得有帮助。但不要完全放弃铬;某些时候您将需要 Ember Inspector



我正在使用同样的调试帮助器大家推荐,这是Chrome显示的方式:





当我在firebug中展开相同的对象时,我得到以下信息,包括我正在寻找的变量(sources [])以及我在Chrome中没有看到的其他一些有用的属性。




I'm working on my first Ember.js app and am having some trouble connecting all the dots. It would be really helpful if I could just see all the variables available within a given handlebars template.

There is a related question, but you have to know the variable that is in scope to use it: How do I add console.log() JavaScript logic inside of a Handlebars template?

How can I output all the variables?

解决方案

Make sure you try out Firebug - you'll get a different perspective on things, which I found helpful. But don't abandon chrome completely; you will need the Ember Inspector at some point.

I'm using the same debugging helper everyone recommends, and this is how Chrome displays it:

When I expand the same object in firebug, I get the following info, including the variables I was looking for (sources[]) and some other useful properties I hadn't seen in Chrome.

这篇关于如何查看手柄模板中的所有可用变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆