问题
we are building an angular application, which we will embed in an existing IOS and android application as a webview. I want to create a communication between angular application and native application.
Eg: On certain events like download, angular UI should send some data to native apps to use default app behavior like that ..
From the basic search i found that it can be done by using javascript.
I want to know the best approach to do this(Architecture level), ie communication between angular UI and Native apps.
回答1:
If you already have an native iOS / Android app and just like you embed your Angular responsive web app inside, you can communicate using JavaScript Interfaces.
But if you are interested in giving a complete native performance, look & feel for your Angular app, the choice could be NativeScript. You will have to rewrite your HTML components using the cross platform layouts / components that comes out of the box with NativeScript framework, but still you can reuse your Angular Controllers, Models, Services etc.,
Docs:
https://docs.nativescript.org/code-sharing/intro
https://docs.nativescript.org/angular/start/introduction
来源:https://stackoverflow.com/questions/52591767/angular-5-and-native-ios-android-communication