如何在jsfiddle中调试js [英] how to debug the js in jsfiddle

查看:169
本文介绍了如何在jsfiddle中调试js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在看这个jsfiddle: http://jsfiddle.net/carpasse/mcVfK/
它工作正常,这不是问题,我只想知道如何通过JavaScript进行调试。我试图使用调试器命令,我不能在源选项卡中找到它?
任何想法如何调试这个?



从小提琴的一些代码:

  angular.module('app',['appServices'])
.config(['$ routeProvider',function($ routeProvider){
$ routeProvider。$ b $ ('/ home',{templateUrl:'home.html',controller:HomeCtrl})
当('/ list',{templateUrl:'list.html',controller:ListCtrl})
当('/ details',{templateUrl:'settings.html',控制器:'/ detail /:itemId',{templateUrl:'detail.html',controller:DetailCtrl}
否则({redirectTo:'/ home'});
}]);


解决方案

直接添加单词 ; 到您的JavaScript,Chrome会在此时中断



添加



<$ p $调试器p>

http://jsfiddle.net/mcVfK/111/



请注意,调试控制台(F12)在打开调试器之前必须打开;打电话或者不起作用。


I am looking at this jsfiddle: http://jsfiddle.net/carpasse/mcVfK/ It works fine that is not the problem , I just want to know how to debug through the javascript. I tried to use the debugger command and I cant find it in the sources tab? any idea how I can debug this?

some code from the fiddle:

angular.module('app', ['appServices'])
    .config(['$routeProvider', function($routeProvider) {
        $routeProvider.
                when('/home', {templateUrl: 'home.html',   controller: HomeCtrl}).
                when('/list', {templateUrl: 'list.html',   controller: ListCtrl}).
                when('/detail/:itemId', {templateUrl: 'detail.html',   controller: DetailCtrl}).
                when('/settings', {templateUrl: 'settings.html',   controller: SettingsCtrl}).
                otherwise({redirectTo: '/home'});
}]);

解决方案

Literally add the word debugger; to your javascript and Chrome will break at that point

Added

debugger;

http://jsfiddle.net/mcVfK/111/

Note you must have the debugging console (F12) open before it hits the debugger; call or it won't work.

这篇关于如何在jsfiddle中调试js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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