{"action":"opened","issue":{"url":"https://api.github.com/repos/johnpapa/angular-tour-of-heroes/issues/147","repository_url":"https://api.github.com/repos/johnpapa/angular-tour-of-heroes","labels_url":"https://api.github.com/repos/johnpapa/angular-tour-of-heroes/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/johnpapa/angular-tour-of-heroes/issues/147/comments","events_url":"https://api.github.com/repos/johnpapa/angular-tour-of-heroes/issues/147/events","html_url":"https://github.com/johnpapa/angular-tour-of-heroes/issues/147","id":373713519,"node_id":"MDU6SXNzdWUzNzM3MTM1MTk=","number":147,"title":"Push an array inside a array and after update array and save to database - angular","user":{"login":"natashanodine","id":5288977,"node_id":"MDQ6VXNlcjUyODg5Nzc=","avatar_url":"https://avatars2.githubusercontent.com/u/5288977?v=4","gravatar_id":"","url":"https://api.github.com/users/natashanodine","html_url":"https://github.com/natashanodine","followers_url":"https://api.github.com/users/natashanodine/followers","following_url":"https://api.github.com/users/natashanodine/following{/other_user}","gists_url":"https://api.github.com/users/natashanodine/gists{/gist_id}","starred_url":"https://api.github.com/users/natashanodine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natashanodine/subscriptions","organizations_url":"https://api.github.com/users/natashanodine/orgs","repos_url":"https://api.github.com/users/natashanodine/repos","events_url":"https://api.github.com/users/natashanodine/events{/privacy}","received_events_url":"https://api.github.com/users/natashanodine/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-24T23:17:24Z","updated_at":"2018-10-24T23:17:24Z","closed_at":null,"author_association":"NONE","body":"I want to push an array comment in to cabin.comments array and after UPDATE of the cabin array with the new comment in it when the user submits a comment using the onSubmit() and update the cabin with the updateCabin.\r\nIn the console when running \"ng serve --open\" I am getting an error: \r\n\r\nerror TS1128: Declaration or statement expect\r\n\r\nI am using a JSON database in the main folder.  \r\nI am really new to angular and I am lost.\r\n\r\nThis is my component file with my onSubmit\r\n\r\n\r\n\t\t  \r\n\t \r\n\t  onSubmit(id) {\r\n\t\t  \r\n\t\t\tthis.cabin.comments.push(this.comment);\r\n\t\t this.cabinService.updatePosts(this.cabin.id);\r\n\t  \t  \r\n\t\tthis.commentForm.reset({\r\n\t\t\tauthor: '',\r\n\t\t\trating: 5,\r\n\t\t\tcomment: ''\r\n\t\t});\r\n\t  }\r\n\r\n\r\n\r\nMy cabinService\r\n\r\n\t updatePosts(id){\r\n\t const data={\"cabin\": \"Cabin\"};\r\n\t return this.http.get<{cabin: Cabin}>('http://localhost:3000/cabins/'+id).pipe(\r\n\t  map(cabin=>{\r\n\t\tconsole.log(cabin);\r\n\r\n\r\n\t\t return{\r\n\t\t\t   description: cabin.description,\r\n\t\t\t   featured: cabin.featured,\r\n\t\t\t   comments: cabin.comments\r\n\r\n\t\t\t };\r\n\r\n\r\n\t\t })\r\n\t\t).subscribe(updatedEntries=>{\r\n\t\t\t\tconsole.log(updatedEntries);\r\n\r\n\t\t  updatedEntries.comments.push(data);\r\n\t\t  return this.http.put('http://localhost:3000/cabins/' +id, updatedEntries);\r\n\r\n\t\tconsole.log(updatedEntries);\r\n\r\n\t});\r\n\r\n\r\nMy JSON database\r\n\r\n\t\t  \"cabins\": [\r\n\t\t\t{\r\n\t\t\t  \"id\": 0,\r\n\t\t\t  \"description\": \"Tucked away on the hillside among lush gardens of banana & citrus trees\",\r\n\t\t\t  \"featured\": \"true\",\r\n\t\t\t  \"comments\": [\r\n\t\t\t\t{\r\n\t\t\t\t  \"rating\": 5,\r\n\t\t\t\t  \"comment\": \"Beautiful place!\",\r\n\t\t\t\t  \"author\": \"John Gomez\",\r\n\t\t\t\t  \"date\": \"2018-10-16T17:57:28.556094Z\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t  \"rating\": 4,\r\n\t\t\t\t  \"comment\": \"Amazing!\",\r\n\t\t\t\t  \"author\": \"Paul Villar\",\r\n\t\t\t\t  \"date\": \"2017-09-05T17:57:28.556094Z\"\r\n\t\t\t\t}\r\n\t\t\t  ]\r\n\t\t\t}\r\n          ]\r\n\r\n\r\n    \r\n\r\n"}}
{"actor":{"display_login":"natashanodine"}}