Trato de mostrar mi Objeto desde un servicio GET pero únicamente puedo ver [Object][object].
Service:
return this.http.get('http://localhost:3000/words').map((res: Response) => res.json());
return this.http.get('http://localhost:3000/words').map((res: Response) => res.json());
Controller:
export class WordsComponent implements OnInit { words: Word[]; private _productService;
export class WordsComponent implements OnInit {
words: Word[];
private _productService;
constructor(servicio : WordsService, public http: HttpClient) {
this._productService = servicio;
this.words = this._productService.getWords();
console.log("Ver words " + JSON.stringify(this._productService.getWords()));
}
ngOnInit(): void {}
JSON: [ { "id": 1, "name": "test", "translate": "prueba", "created_at": "2018-06-10T21:15:06.000Z", "updated_at": "2018-06-10T21:15:06.000Z" }, { "id": 2, "name": "test-one", "translate": "prueba-uno", "created_at": "2018-06-10T21:15:22.000Z", "updated_at": "2018-06-10T21:15:22.000Z" }]
[
{
"id": 1,
"name": "test",
"translate": "prueba",
"created_at": "2018-06-10T21:15:06.000Z",
"updated_at": "2018-06-10T21:15:06.000Z"
},
{
"id": 2,
"name": "test-one",
"translate": "prueba-uno",
"created_at": "2018-06-10T21:15:22.000Z",
"updated_at": "2018-06-10T21:15:22.000Z"
}]