JSON : Placeholder (https://jsonplaceholder.typicode.com/) 是一个用于测试的 REST API 网站。
以下使用 RxJS6 + Angular 6 调用该网站的 REST API,获取字符串以及 JSON 数据。
除了 DELETE 之外其余4个API都返回JSON数据,格式(JSON-Schema)如下:
{
"type":"object",
"properties": {
"userId": {"type" : "integer"},
"id": {"type" : "integer"},
"title": {"type" : "string"},
"body": {"type" : "string"}
}
}
# 安装 Angular CLI
$ npm install -g @angular/cli
# 创建新的应用程序 RestExample
$ ng new RestExample
```
ReactiveX 学习笔记(18)使用 RxJS + Angular 调用 REST API
原文:https://www.cnblogs.com/zwvista/p/9523127.html