Angular 5和本机IOS/Android通信 [英] Angular 5 and native IOS/Android communication

查看:51
本文介绍了Angular 5和本机IOS/Android通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在构建一个有角度的应用程序,它将作为网络视图嵌入到现有的IOS和android应用程序中.我想在角度应用程序和本机应用程序之间建立通信.

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.

例如:在诸如下载之类的某些事件中,Angular UI应该将一些数据发送到本机应用程序,以使用诸如此类的默认应用程序行为..

Eg: On certain events like download, angular UI should send some data to native apps to use default app behavior like that ..

从基本搜索中,我发现可以使用javascript来完成.

From the basic search i found that it can be done by using javascript.

我想知道执行此操作的最佳方法(体系结构级别),即,角度UI和本机应用程序之间的通信.

I want to know the best approach to do this(Architecture level), ie communication between angular UI and Native apps.

推荐答案

如果您已经拥有本机iOS/Android应用,并且就像将Angular响应式Web应用嵌入其中一样,则可以使用JavaScript接口进行通信.

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.

但是,如果您有兴趣提供完整的本机性能,请查看&对于您的Angular应用而言,可以选择NativeScript.您将不得不使用NativeScript框架提供的跨平台布局/组件来重写HTML组件,但仍然可以重用Angular控制器,模型,服务等.

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.,

文档:

https://docs.nativescript.org/code-sharing/intro

https://docs.nativescript.org/angular/start/introduction

这篇关于Angular 5和本机IOS/Android通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆