Json RxJS:将两个http.get()组合到一个对象

Json RxJS:将两个http.get()组合到一个对象,json,wordpress,angular,rxjs,observable,Json,Wordpress,Angular,Rxjs,Observable,我用Angular 2访问我的Wordpress数据库。我使用它们并返回一个json对象,我映射它来创建一个对象 对象: export class BlogPost { date: Date; id: number; link: string; title: string; author: number; excerpt: string; featuredMediaURL: string; featuredMediaID: numb

我用Angular 2访问我的Wordpress数据库。我使用它们并返回一个json对象,我映射它来创建一个对象

对象:

export class BlogPost {
    date: Date;
    id: number;
    link: string;
    title: string;
    author: number;
    excerpt: string;
    featuredMediaURL: string;
    featuredMediaID: number;
    categories: string[];
    tags: string[];


    constructor(obj?: any) {
        this.date               = obj && obj.date               || null;
        this.id                 = obj && obj.id                 || null;
        this.link               = obj && obj.link               || null;
        this.title              = obj && obj.title              || null;
        this.author             = obj && obj.author             || null;
        this.excerpt            = obj && obj.excerpt            || null;
        this.featuredMediaURL   = obj && obj.featuredMediaURL   || null;
        this.featuredMediaID    = obj && obj.featuredMediaID    || null;
        this.categories         = obj && obj.categories         || null;
        this.tags               = obj && obj.tags               || null;
    }
}
服务:

export class BlogService {
    constructor(public http: Http,
                @Inject(DOMAIN) private domain: string) {  }

    getPost(): Observable<BlogPost[]> {
        return this.http.get(`${this.domain}/wp-json/wp/v2/posts/?page=1`)
            .map((response: Response) => {
                return (<any>response.json()).map(item => {
                    return new BlogPost({
                        date: item.date,
                        id: item.id,
                        link: item.link,
                        title: item.title,
                        author: item.author,
                        excerpt: item.excerpt,
                        featuredMediaID: item.featured_media,
                        categories: item.categories,
                        tags: item.tags
                    });
                });
            });
    }
但这有点乏味。我想知道是否有一种干净的rxjs方法可以通过发出

this.http.get(`${this._domain}/wp-json/wp/v2/media/<id>`)
this.http.get(`${this._domain}/wp-json/wp/v2/media/`)
行并将其映射到BlogPost.featuredMediaURL,然后将整个post数组返回到blog组件


我花了一天的时间尝试了几件事,弄得我不知所措。

在上面的代码块上下文中使用的
mediaURL
函数在哪里?什么是身份证?它是
featureMediaID
?@palpdaniels mediaURL位于组件中,并在模板中用
{{mediaURL(b.featuredMediaID)}
调用。正确的是,
id
BlogPost
类中的
featuredMediaID
。在上述代码块的上下文中使用的
mediaURL
函数在哪里?什么是身份证?它是
featureMediaID
?@palpdaniels mediaURL位于组件中,并在模板中用
{{mediaURL(b.featuredMediaID)}
调用。因此正确的是,
id
BlogPost
类中的
featuredMediaID
this.http.get(`${this._domain}/wp-json/wp/v2/media/<id>`)