在浏览器

时间:2016-07-01 07:42:40

标签: ionic-framework ionic-view

作为Ionic Developer,您如何进行浏览器调试?

我已经和Ionic合作了几个星期了,虽然我正在设计它,但在调试时我仍然很挣扎。

在大多数情况下,离子框架会返回一个非常通用的非详细错误,并且堆栈跟踪中提供的任何信息都没有指向我自己的源代码(请参阅下面的示例)。我甚至不知道从哪里开始。

  

错误:节点未定义       编译/< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:20673:1       的forEach @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:13648:11       编译@ http://localhost:8100/lib/ionic/js/ionic.bundle.js:20672:7       generateNavBarItem @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:58872:14       self.beforeEnter@http://localhost:8100/lib/ionic/js/ionic.bundle.js:58811:26       。$ RootScopeProvider /这$ gethttp://本地主机:8100 / lib目录/离子/ JS / ionic.bundle.js:29404:15       ionicViewSwitcher.create/switcher.emit@http://localhost:8100/lib/ionic/js/ionic.bundle.js:55182:13       ionicViewSwitcher.create/switcher.transition@http://localhost:8100/lib/ionic/js/ionic.bundle.js:55038:13       self.render /< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:56749:7       ionicViewSwitcher.create / switcher.init /< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:54916:25       ionicViewSwitcher.create/switcher.render@http://localhost:8100/lib/ionic/js/ionic.bundle.js:55005:23       ionicViewSwitcher.create/switcher.init@http://localhost:8100/lib/ionic/js/ionic.bundle.js:54915:11       self.render@http://localhost:8100/lib/ionic/js/ionic.bundle.js:56743:5       self.register@http://localhost:8100/lib/ionic/js/ionic.bundle.js:56701:5       更新视图@ http://localhost:8100/lib/ionic/js/ionic.bundle.js:62357:11       .compile / HTTP://本地主机:8100 / LIB /离子/ JS / ionic.bundle.js:62334:11       。$ RootScopeProvider /这$ gethttp://本地主机:8100 / lib目录/离子/ JS / ionic.bundle.js:29477:15       transitionTo / $ state.transition< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:49321:11       processQueue @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:27879:28       scheduleProcessQueue /< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:27895:27       。$ RootScopeProvider /这$ gethttp://本地主机:8100 / lib目录/离子/ JS / ionic.bundle.js:29158:16       。$ RootScopeProvider /这$ gethttp://本地主机:8100 / lib目录/离子/ JS / ionic.bundle.js:28969:15       。$ RootScopeProvider /这$ gethttp://本地主机:8100 / lib目录/离子/ JS / ionic.bundle.js:29263:13       超时/ timeoutId< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:31030:25       completeOutstandingRequest @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:18706:7       浏览器/ self.defer / timeoutId< @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:18978:7

2 个答案:

答案 0 :(得分:2)

由于这是JavaScript,您还可以使用Debugging with breakpoints (Debugging JavaScript)。这对你有很大帮助。

enter image description here

有关调试的更多信息:How to Properly Debug Your Ionic Application

答案 1 :(得分:1)

以下是一些可帮助您进行调试的提示

1.使用ionic serve -l获取模拟器Web视图,然后转到检查元素find console它会显示您发生的所有错误     应用

2.安装智能手机并使用chrome://inspect检查您的应用程序

3。ionic run -lc