Call AngularJS from legacy code

Loading...

Call AngularJS from legacy code

I’m using AngularJS to build HTML controls that interact with a legacy Flex application. All callbacks from the Flex app must be attached to the DOM window.
For example (in AS3)
ExternalInterface.call(“save”, data);

Will call
window.save = function(data){
// want to update a service
// or dispatch an event here…
}

From within the JS resize function I’d like to dispatch an event that a controller can hear. It seems that creating a service is the way to go. Can you update a service from outside of AngularJS? Can a controller listen for events from a service? In one experiment (click for fiddle) I did it seems like I can access a service but updating the service’s data doesn’t get reflected in the view (in the example an

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.