javascript - 如何读取 angular4 中响应 HTTP 请求而收到的 protobuf 对象

标签 javascript arrays angular arraybuffer protobuf.js

尝试读取protobuf对象而不是Angular4中的JSON对象。

我找到了这个dcodeIO/protobufjs 。但我不明白我应该如何在我的项目中使用它?

我还尝试使用 Typings install dt~protobufjs --global 安装 protobufjs 的类型。当我导入它时,WebStorm 说找不到模块 protobuf。

任何帮助!赞赏!

最佳答案

我们可以使用 google-protobuf 库读取 angular4 中的 protobuf 对象。 导入语法是 -

## import * as goog from 'google-protobuf'; ##

引用 github 链接是 - https://github.com/sparten11740/angular-protobuf-example

关于javascript - 如何读取 angular4 中响应 HTTP 请求而收到的 protobuf 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48108904/

相关文章:

javascript - 在模态框内响应 Native FlatList

javascript - walk.js 似乎无法工作,即使我已经包含并绑定(bind)了它

arrays - 如何获取给定范围内大于x的元素?

angular - nrwl nx 应用程序 (Angular7/Typescript) 之间的共享样式 (scss)

javascript - 为什么在 Hawk 中创建授权请求 header 时出现错误 'Internal Server Error'?

javascript - 使用 var 与 let/const 的 block 级变量重新声明

javascript - 将项目数组减少为单个数组列表

php - 数组值仅返回第一个字符和额外值

javascript - Angular2 从 HTML 数据属性获取数据到组件

javascript - 如何更改子组件 HTML