1

After I run grunt serve to have my AngularJS app running locally... I can't figure out how to have things write to the terminal window besides other Grunt tasks.

pic of my terminal window

Specifically, I would like to have the ability to write out things using console.log() to my terminal window -- in addition of course to seeing them in the browser's javascript console.

Is that possible & how would I do that?

2
  • 1
    you can use gruntjs.com/api/grunt.log instead Commented Sep 24, 2015 at 4:53
  • I saw that, very cool. I will look into it more and see if I can figure out how to use Grunt log for that purpose Commented Sep 24, 2015 at 6:08

3 Answers 3

3

Not easily unless you run your javascript in a headless browser like phantomJS or execute it in node.

console.log() displays in the consoles of browsers like chrome or firefox because they "execute" your code. Grunt is just building out your javascript files.. not executing them

Sign up to request clarification or add additional context in comments.

Comments

1

Your command line is representative of your server - you would need to be running console.log() in your server side code (or whatever is language appropriate for your backend).

Comments

1

This might be blindingly obvious to others, but for a beginner at Angular, when I was calling console.log() I was expecting to see output in my node.js server window, but in fact the output is shown in the web console.

For Firefox: hamburger menu, Web developer, web console (or Ctrl-Shift-K)

For Chrome: hamburger menu, More tools, Developer tools, and select Console tab in pane on the right.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.