32

Looking at the videos over at http://egghead.io, I see the author uses console.log to log out the contents of a $scope or scope object. The output in Chrome is a drillable object. However when I do the same, the output Chrome presents is:

    [object Object]
No Properties

Using console.dir has the same affect. Any recommendations?

Thanks,

0

3 Answers 3

86

The + operator calls to the toString method of the object which would return '[object object]'

So using log like this:

console.log('scope is ' + scope);

Produced the string scope is [object object]

Instead use the console.log() method with commas (as commented below) to be able to drill into the scope object:

console.log('scope is', scope)
Sign up to request clarification or add additional context in comments.

1 Comment

Or you could do something like: console.log('object is ', object); (you can give multiple arguments.)
3

Use console.log(formValues); instead of console.log("Values="+formValues);. If you use console.log("Values="+formValues); ,it is considered as string and output as [Object object]

Comments

1

You can use JSON.stringify() function to display values of result received from database.

console.log("Result: " + JSON.stringify(res));

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.