简体   繁体   English

我可以在Chrome调试器中为对象添加属性吗?

[英]Can I add properties to an object in the Chrome debugger?

I know I can edit values or properties on an object in the Chrome debugger, but is there a way to add properties? 我知道我可以在Chrome调试器中编辑对象的值或属性,但有没有办法添加属性?

Edit: Here's an example of what I mean. 编辑:这是我的意思的一个例子。 In this popup window I can edit that values of these properties on this object. 在此弹出窗口中,我可以在此对象上编辑这些属性的值。 Is there a way I can add new properties to this object? 有没有办法可以为这个对象添加新属性?

在此输入图像描述

For the example in your image, if you were stopped in debugging mode all you would have to do is enter something like $scope.newProp = 'value'; 对于图像中的示例,如果您在调试模式下停止,则只需输入$scope.newProp = 'value'; into the console. 进入控制台。 The object will now have a new property while you continue to debug your program. 在继续调试程序时,该对象现在将具有新属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM