简体   繁体   English

在angularjs控制器中从angular 4组件监听事件

[英]Listening to event from angular 4 component in angularjs controller

I'm working on a hybrid angular app. 我正在开发混合角度应用程序。 I need to listen to an event (an observable may be ) in the angularjs controller and the event would be triggered by angular 4 component. 我需要在angularjs控制器中监听一个事件(一个可观察到的事件),并且该事件将由angular 4组件触发。 Is there any way we could actually accomplish this ? 我们有什么办法可以真正做到这一点?

It is not possible to achieve it with events. 通过事件无法实现。 There are two other ways. 还有其他两种方法。

  1. Use localStorage to pass data from and to. 使用localStorage来回传递数据。
  2. You can use NG4 service, downgrade it to angularJS and set and get value from and to. 您可以使用NG4服务,将其降级为angularJS并从中获取价值。

Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM