Angular 2 is fairly new. I have been using firebase-angular2 to create a service. I ran the firebase-angular2 demo here https://github.com/KallynGowdy/firebase-angular2-demo but when I have been running it I get the following error
EXCEPTION: TypeError: heroes.map is not a function angular2.dev.js:23083 EXCEPTION: TypeError: heroes.map is not a function
As far as I can tell it is referring to this section of code at ts/firebase-heros.service.ts
import {Injectable} from "../../node_modules/angular2/core";
import {HeroService} from "./hero.service";
import {Observable} from "../../node_modules/rxjs/Rx";
import {FirebaseService} from '../../node_modules/firebase-angular2/core';
import {Hero} from "./../interfaces/hero";
@Injectable()
export class FirebaseHeroService extends HeroService {
private service:FirebaseService;
constructor(firebaseService:FirebaseService) {
this.service = firebaseService.child('heroes');
}
getHeroes() {
var service = this.service;
return service.value.map((heroes) => {
return heroes.map((h, i) => {
// TODO: Cleanup
return {
id: h.id,
name: h.name,
save: function () {
return service.child(i.toString()).setData({
id: this.id,
name: this.name
});
}
}
})
});
}
}
Any ideas of what may be causing this problem? thanks in advance