Skip to content

http.get(..).map function is not working with alpha 48 #5632

Description

@MurhafSousli

since I updated to alpha 48, http.get(...).map is no longer working.

EXCEPTION: TypeError: json.map is not a function in [null]

@Injectable()
export class WPService implements IWPService {
    baseURL: string = 'http://localhost/wptest/api';
    http: Http;
    constructor(http: Http) {
        this.http = http;
    }
    GetPosts() {
        var query = this.baseURL + '/get_posts/';
        return new JsonObject(this.http.get(query));
    }
}

@Injectable()
export class JsonObject {
    constructor(json: Observable<any>) {
        json.map(res => res.json()).map(data => {          // <= 
            for (var entry in data) {
                if (data.hasOwnProperty(entry)) {
                    this[entry] = data[entry];
                }
            }
        }).subscribe();
    }
}

when I downgraded to alpha 47, .map worked again. maybe it has something to do with the integrated rxjs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions