title: Updating an BehaviorSubject based on User Input in Angular 5
body: <p>I have some default data for a table that is being fetched by a service and stored in a behaviorSubject. The user has the option to add more rows to the table by entering fields in a form. How can I update the Observable to include the user-created data? Or is there a better way to update the data?</p>
  
  <p>I was trying to get the value of the current b.s. and concat the new item and then use next() to update the b.s. but I couldn't get it to work.</p>
  
  <p><strong><em>Edit</em></strong> </p>
  
  <p>vincecampanale had some good points and helped me move the code along but now I'm just getting a 'currentItems.concat is not a function error' even though it was initialized as an array, what else am I missing?</p>
  
  <p>Updated Code:</p>
  
  <pre><code>defaults = this.http.get(this.url);
  
  private defaultItems = new BehaviorSubject&lt;any&gt;(this.defaults);
  items = this.defaultItems.asObservable();
  
  addItem(item: object) {
      let currentItems = [];
      currentItems = this.defaultItems.getValue();
      let updatedItems = currentItems.concat(item);
      this.defaultItems.next(updatedItems);
  }
  </code></pre>