I'm using AngularJS to build HTML controls that interact with a legacy Flex application.(我正在使用AngularJS来构建与传统Flex应用程序交互的HTML控件。)
All callbacks from the Flex app must be attached to the DOM window.(Flex应用程序中的所有回调都必须附加到DOM窗口。)For example (in AS3)(例如(在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.(在JS resize函数中,我想发送一个控制器可以听到的事件。)
It seems that creating a service is the way to go.(似乎创建服务是最佳选择。) Can you update a service from outside of AngularJS?(你能从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<option>
should be added to the <select>
).(在一个实验(点击小提琴)我做了似乎我可以访问服务,但更新服务的数据不会反映在视图中(在示例中, <option>
应添加到<select>
)。)
Thanks!(谢谢!)
ask by kreek translate from so