0

I am working on a hybrid app, it's running a main Angular (7) component and within it has an upgraded (through ngUpgrade) AngularJS component running a Gantt chart. I am trying to pass the data it needs from the Angular component's controller to the AngularJS one, but I'm failing to find resources on this topic, which makes me think it is not possible. Anyhow, I would like to ask just in case anyone has ever tried this.

Thank you in advance!

  • Possible duplicate of [Running Angular and AngularJS frameworks side by side](https://stackoverflow.com/questions/43523907/running-angular-and-angularjs-frameworks-side-by-side) – Guy Yogev Mar 13 '19 at 10:36
  • @GuyYogev The suggested duplicate does not address the problem of passing information. - [From review](https://stackoverflow.com/review/close/22451402). – georgeawg Mar 13 '19 at 17:40

1 Answers1

0

You can use global object, like window. Add to this object properties chanel like RxJS/BehaviourSubject. Remember import RxJs library.

  1. In index.html add script where define chanel
<body>
<script>
 window['myChanel'] = new BehaviourSubject()
</script>
</body>
  1. In AngularJS app, where you need, set Observer:
let transData;
window.myChanel.pipe(tap(value => transData = value ))).subscribe()
  1. In Angular app, use chanel for emit value
window.myChanel.emit('myTestValue')
Oleg
  • 391
  • 3
  • 11