I have a problem in my GET route. As the title says. Html code:
<ion-card *ngFor="let room of rooms">
Component:
rooms : any;
this.rooms = this.roomsService.getRooms();
Provider:
getRooms(){
return new Promise(resolve => {
this.http.get('http://localhost:8080/api/rooms/')
.map(res => res.json())
.subscribe(data => {
resolve(data);
});
});
}
And server side:
exports.getRooms = function (req, res) {
Room.find({}, function (err, rooms) {
if (err) {
res.send(err);
} else {
res.json(rooms);
}
});
}
What am I doing wrong?
via Chris K.
No comments:
Post a Comment