Here is my code, I can't figure out why this is saying .map not a function. This is a generic method.
public findTeamRoles(id: any, userId: any): Observable<any> {
let _method: string = "GET";
let _url: string = LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() +
"/Programs/:id/findTeamRoles";
let _routeParams: any = {
id: id
};
let _postBody: any = {};
let _urlParams: any = {};
if (userId) _urlParams.userId = userId;
let result = this.request(_method, _url, _routeParams, _urlParams, _postBody);
return result.map((instances: Array<Program>) =>
instances.map((instance: Program) => new Program(instance))
);
}
I'm getting this error:
core.es5.js:1084 ERROR TypeError: instances.map is not a function
resultare not themselves arrays and therefore don't have amapmethod. (Or at least one element is not an array.) Perhaps you should have a close look at the elements withinresultusing your debugger?