I am evaluating web Storm 7.0. I am using the default localhost:63342. I am using my default browser the latest chrome.

Problem: While in debug mode, the Console tab (to the right of debugger tab) has a window where the cursor blinks but editing is disabled. Nothing is ever displayed regardless of whether I step into or let the program run.

I need a simple guide on how to use the web Storm console. The line console.log("adding item to shopping cart"); does not seem to execute.

<html ng-app="myApp">
<head>
<meta charset="utf-8">
<title>Shopping List AngularJS Tutorial</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js">  </script>
<!--<script src="js/appctrl.js"></script>-->
</head>
<body>
 <h1>Shopping List</h1>

 <div ng-controller="AppCtrl">
<p>Using a controller: data.message={{data.message}}!</p>
</div>
<h1>Shopping List</h1>
<form ng-submit="addItem()">
<input type="text" placeholder="item to add" ng-model="itemToAdd" />
<input type="submit" value="add">
 </form>

<br>
<hr>

</div>


var myApp = angular.module('myApp', []);
function AppCtrl($scope) {
    $scope.data={message:'I am a java object data with this message in MyCtrl'};
    $scope.addItem = function() {
        console.log("adding item  to shopping cart");
    };

}

For complete code google:learnwebtutorials angularjs-tutorial-seriesBatarang.I am embarrased to ask such a simple question but have been stuck for days now.

EDIT: This works:

<button onclick="tryConsole()">Try it</button>

<script type = "text/javascript">
  function tryConsole() {
    console.log("hello world");
  }
</script> 

Apparently the problem may be within the angular tutorial code :-( enter image description here

有帮助吗?

解决方案

  • debugger console in WebStom is not interactive - you can't type in it
  • nothing special is needed to see console.log output there - just run your angular.js application in debugger: right-click your .html file and choose 'debug', page will be loaded in browser. Enter the text in textfield, press Add - the console.log() message will be printed to the debugger console
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top