Q:

Pushing data to angularjs externally?

It seems that angularjs can only interact with data that each module has internally, but there's no way for any external javascript to change the data or access a service of angularjs.
For example, if I have some non-angularjs code and an angularjs module running side by side, and the non-angularjs code needs to update some data that angularjs uses (such as by calling a service method), is there a way to do that?
Another example, lets say I'm using Comet and pushing notifications from the server. So e.g, if the user receives a new message, I want to be able to push a notification of that from the server (e.g sending some javascript code via a http-chunk response, and having that code be executed). How could I pass on these notifications to my angular services?

A:

You can reach angular scope trough non-angular js with something like this:
angular.element(document.getElementById('page-data')).scope().$apply(
    function(scope)
    {
        scope.yourScopeMethod( argument1, argument2, ... );
    });

Where:
document.getElementById('page-data')

is the html element containing your angular view.

