Get scope of current loaded view


#1

Hi, I was wondering if there was any way to explicitly get the scope of the current loaded view. I’ve been trying multiple approaches but they all seem not to work.


#2

Hm, I mean $scope is what you’re wanting, but can you give us some more information so we can better help you?

What reason do you need the scope for?
Where in the application are you trying to access it?

This should give us a better idea


#3

Hi, thanks for the reply - I need to pass the scope into an external library so that it can make modifications on the current view. The library is used in multiple views - I need a way to make sure the library is passed the ‘right’ view and not the wrong one.


#4

Hmmmm this generally isn’t the angular way. What’s difficult with Angular and the scope is that you can’t truly modify it from outside the controller, service, or run time in angular. Because angular has it’s own loop for events and such it makes that difficult to do. What would be better is having that library as a function inside your controller or service. I think there is probably a better way to handle this.

What data in your scope do you need modified? What kind of library is it?

I wonder if you can isolate that data to make it easier and possibly use events but it’s hard to say for sure since it’s still a bit vague.