[英]console.log backbone model, attributes property
I wanted to make sure I understood Firebug correctly. 我想确保我正确理解了Firebug。 I print out my model.
我打印出我的模型。 And in the console of firebug, I see in the attributes, it has "myProperty".
在firebug的控制台中,我在属性中看到它具有“ myProperty”。 But then when I do this:
但是当我这样做时:
if (_.has(model, "myProperty"))
or 要么
if (model.hasOwnProperty('myProperty'))
Both do not return a result. 两者都不返回结果。 Is there somethign I'm not understanding about Firebug or JS?
关于Firebug或JS,我是否不了解? Thanks.
谢谢。
If myProperty
is an attribute you've given the model, then it will exist in the attributes object: model.attributes.myProperty
. 如果
myProperty
是您已提供模型的属性,则它将存在于attribute对象: model.attributes.myProperty
。 Does it? 可以?
Note that in the docs , if myProperty
is null or undefined then model.has(myProperty)
will return false
. 请注意,在文档中 ,如果
myProperty
为null或未定义,则model.has(myProperty)
将返回false
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.