如何访问控制台Angular2分量的具体数据? [英] how to access Angular2 component specific data in console?

查看:257
本文介绍了如何访问控制台Angular2分量的具体数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法来访问Angular2特定组件的具体数据,控制台,用于调试的目的?

Is there any way to access Angular2 specific component specific data in console, for debugging purpose?

像Angular1有能力在控制台访问其组成部分的价值。

Like Angular1 has capability to access its components value in console.

推荐答案

下面是一个总结如何做到这一点的 https://github.com/angular/angular/blob/master/TOOLS_JS.md

Here is a summary how to do that https://github.com/angular/angular/blob/master/TOOLS_JS.md

启用调试工具

默认情况下,调试工具将被禁用。您可以启用调试工具如下:

By default the debug tools are disabled. You can enable debug tools as follows:

import {enableDebugTools} from 'angular2/platform/browser';

bootstrap(Application).then((appRef) => {
  enableDebugTools(appRef);
});

使用调试工具

在浏览器中打开开发者控制台(按Ctrl + Shift + J在Chrome)。顶层对象称为NG,并包含在里面更具体的工具。

In the browser open the developer console (Ctrl + Shift + j in Chrome). The top level object is called ng and contains more specific tools inside it.

例如:

ng.profiler.timeChangeDetection();

这篇关于如何访问控制台Angular2分量的具体数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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