{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/angularfire2/issues/664","repository_url":"https://api.github.com/repos/angular/angularfire2","labels_url":"https://api.github.com/repos/angular/angularfire2/issues/664/labels{/name}","comments_url":"https://api.github.com/repos/angular/angularfire2/issues/664/comments","events_url":"https://api.github.com/repos/angular/angularfire2/issues/664/events","html_url":"https://github.com/angular/angularfire2/issues/664","id":187126344,"number":664,"title":"Storing a string[] as a property of an object to firebase","user":{"login":"StevenAderson","id":23102746,"avatar_url":"https://avatars.githubusercontent.com/u/23102746?v=3","gravatar_id":"","url":"https://api.github.com/users/StevenAderson","html_url":"https://github.com/StevenAderson","followers_url":"https://api.github.com/users/StevenAderson/followers","following_url":"https://api.github.com/users/StevenAderson/following{/other_user}","gists_url":"https://api.github.com/users/StevenAderson/gists{/gist_id}","starred_url":"https://api.github.com/users/StevenAderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StevenAderson/subscriptions","organizations_url":"https://api.github.com/users/StevenAderson/orgs","repos_url":"https://api.github.com/users/StevenAderson/repos","events_url":"https://api.github.com/users/StevenAderson/events{/privacy}","received_events_url":"https://api.github.com/users/StevenAderson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-03T16:47:18Z","updated_at":"2016-11-03T16:47:18Z","closed_at":null,"body":"I have an object called Post:\r\n\r\n    constructor(\r\n        public repliers: string[''],\r\n        public key: string = null\r\n    ) {}\r\n\r\nHere is the service method which pushs the post:\r\n\r\n    submitPost(post: Post) {\r\n        this.af.database.list('posts').push(post);\r\n    }\r\n\r\nHere is the method which subscribes to the posts table:\r\n\r\n    subscribeAllPosts(): Observable<Post[]> {\r\n        return this.af.database.list('posts')\r\n        .map(Post.fromJsonList);\r\n    }\r\n\r\nIn the post class here are the static methods for converting it from json:\r\n\r\n    static fromJsonList(array:any): Post[] {\r\n        return array.map(Post.fromJson);\r\n    }\r\n\r\n    static fromJson({repliers, $key }:any): Post {\r\n        return new Post(repliers, $key );\r\n    }\r\n\r\nWhen I submit a post it works and the post on firebase looks like:\r\n\r\n    posts\r\n        -> unique key\r\n               ->  repliers\r\n                         -> 0: ''\r\n\r\nWhen I loop through my posts after submitting one I see the array as a property with the one default blank key. \r\n\r\nMy issue that I want to solve is how to update a post in the posts table to be able to push extra keys to the repliers array and also delete from the array.\r\n\r\nA concern is how to update this list without replacing the whole thing as other users might also be adding/removing from it. Thanks"}}
{"actor":{"display_login":"StevenAderson"}}