小编Art*_*rev的帖子

在 Angular 6 中通过 http get 处理复杂对象

我不明白如何处理我订阅的对象。对象是以下结构:

{
  data:{
       date: "2018-02-20 13:10:23",
       text: "????????",
       id: 1,
       items: [
              0: {
                 date: "2018-02-20 13:10:23",
                 text: "????????",
                 images: [
                         0: "image1.jpg",
                         1: "image2.jpg"
                         ],
                 name: "???????????",
                 type: "images"
                 },
              1: {
                 date: "2018-02-20 13:10:23",
                 text: "????????",
                 image: null,
                 type: "video",
                 url: "https://www.youtube.com/embed/v64KOxKVLVg"
                 }
              ]
       }
}
Run Code Online (Sandbox Code Playgroud)

我通过服务提出上诉:

import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
@Injectable()
export class VideoService {
    constructor(private http: HttpClient) {}

    getVideoTape() {
        return this.http.get(`http://ip_adress/api/v1/mixed_galleries/1`);
    }
}
Run Code Online (Sandbox Code Playgroud)

有一个接口模型:

export class VideoListModel {
    constructor(
        public created_at: …
Run Code Online (Sandbox Code Playgroud)

filter typescript angular angular6 rxjs6

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×1

angular6 ×1

filter ×1

rxjs6 ×1

typescript ×1