I have an angular2 app with services making Http calls to the server api. How can I call just these services in a different app that uses react.js without bootstrapping the angular2 or without using angular components.
App1(angular2) -> component1 -> SharedService1(say http api client)
^
|(call service from react to get data)
App2(react) -> React Component
Just create a new injector with HTTP_PROVIDERS and acquire Http from it like:
let injector = ReflectiveInjector.resolveAndCreate([HTTP_PROVIDERS]);
let http = injector.get(Http);
http.get('http://someurl').subscribe(...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With