Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Right click scope object to use "Store as global variable" feature from console #281

Closed
tim545 opened this issue Nov 18, 2015 · 8 comments
Closed

Comments

@tim545
Copy link

tim545 commented Nov 18, 2015

I'm not sure if this is actually possible to put into an extension but it would nice to have. Copying the object to a global variable means you can run some simple tests against it in the console, just as bit of a shorthand if your debugging something.

@SomeKittens
Copy link
Member

Whenever you select an element in the Elements pane, we set the global $scope to the scope of that variable, so that's a first step. Would be nice to just get whatever you're looking at directly though.

@tim545
Copy link
Author

tim545 commented Nov 20, 2015

Yeah ok I see that now... which actually works for purpose I wanted which is cool. But the feature I was wanting to replicate was something in the console when have done a console.log() from your code you can right click that log entry and select "store as global variable" (screen shot below) which then assigns it a variable name so you can do some simple manipulations on it there in the console. But of course as you said the $scope object will always be there! I just didn't notice it before.

screen shot 2015-11-20 at 1 46 42 pm

@SomeKittens
Copy link
Member

Yep, and we'll see about adding that too! It's a good suggestion, we're a bit backlogged though.

@tim545
Copy link
Author

tim545 commented Nov 23, 2015

That's ok, if you could get it into a future release sometime that would be really cool!

@ProLoser
Copy link

@tim545 I think this is tricky because variables are always in context of scope. There's no reason you can't console log in your current ng codebase, but to figure out what scope data you want is complex and requires you to poke around the DOM. Once it's done, you can do window.x = $scope so it persists

@stan-kondrat
Copy link

@tim545 you can use "$scope" element tab:

@tim545
Copy link
Author

tim545 commented Dec 29, 2015

@ProLoser Sure no worries, I always only suggested it because I thought it would be a nice shortcut of sorts instead of logging from the code etc. but It's no big deal. I like the solutions you and @stan-kondrat have found anyway! thanks for those. If it's something that's too big to implement for a small feature I'd be happy with closing the issue, no point leaving it lying around

@SomeKittens
Copy link
Member

Thanks, @stan-kondrat, didn't know about that one! Looks good enough to close. Thanks for bringing this up and having a great attitude, @tim545

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants