title: Angular 2 Observable Refresh
body: <p>I'm trying to refresh my table at parent after update operation from child component.</p>
  
  <p>@service</p>
  
  <pre><code>getLicenses(){
       ...
       return this.http.post(url","",options)
          .map((result: Response) =&gt; result.json())
            .map((data: License[]) =&gt; {
                this.licenses = data;
  
                return this.licenses;
              })
              .catch(this.handleError);
  }
  </code></pre>
  
  <p>@ parent component</p>
  
  <pre><code> ngOnInit() {
      this.licenseService.getLicenses().subscribe(licenses =&gt; {
                                            this.licenses = licenses;
   }); 
  </code></pre>
  
  <p>Everything looks good at initialization. I have datas in table.
  When a row is selected from table I pass it to child component and do update operation. After update, I want to refresh table and call getLicenses() method of service. But it doesn't refresh.If I call another method to test, it refreshes my table.</p>
  
  <pre><code>  getLicenses2(){
      this.licenses.pop();
      this.licenses.pop();
      this.licenses[2].isFree=  !this.licenses[2].isFree;
    }
  </code></pre>
  
  <p>Also I tested like below and this doesn't refresh.</p>
  
  <pre><code>  getLicenses2(){
  
         this.http.post(url,"",options)
              .map((result: Response) =&gt; result.json())
                .map((data: License[]) =&gt; {
                    this.licenses = data;
                    this.licenses.pop();
                    this.licenses.pop();
                  })
                  .catch(this.handleError);
    }
  </code></pre>
  
  <p>Why does this work when I change array manually? 
  Why does not work when I assign data of json?  </p>
  
  <p>My response is OK there is no exception and first initialization works well.Update operation is succesfull also if I just refresh table with f5 new data is coming.
  (I'm new to Angular 2)</p>
  
  <p><strong>Edit</strong></p>
  
  <p>It work with or without subject if I just change array but it doesnt work when I do it in http post</p>
  
  <p>I tried with Subject. This time there is no child. Initialization does not work when I call http post. see test methods below.</p>
  
  <p>@service i have</p>
  
  <pre><code>private licenses2 = new Subject&lt;License[]&gt;();
  licenses2$ = this.licenses2.asObservable();
  </code></pre>
  
  <p>@ parent component </p>
  
  <pre><code> ngOnInit() {
      this.licenseService.licenses2$.subscribe(licenses =&gt; {
          this.licenses = licenses;
       } );
      this.licenseService.getLicenses2();
   }
  </code></pre>
  
  <p>works</p>
  
  <pre><code>getLicenses2() {
     let test: License[] = [];
     test.push(new License());
  
     this.licenses2.next(test)
  }
  </code></pre>
  
  <p>doesnt work</p>
  
  <pre><code> getLicenses2(){
     this.http.post(URL,"",options)
          .map(response =&gt; {
                this.licenses2.next(response.json() as License[])
          })
          .catch(this.handleError);
    }
  </code></pre>
  
  <p>Thank you.</p>