title: Reset a array before subscribe angular2
body: <p>I am trying to use multiple filter in quick session i am getting the previous data in array along with the new data. How to remove the previous data.</p>
  
  <p>component.ts</p>
  
  <pre><code>ngOnInit() {
    this.vehicleAttribute = JSON.parse(sessionStorage.getItem('vehicleAttributes'));
    const data: ProductCatalogPostData = {
      vehicleModelAttributes: this.vehicleAttribute.vehicleModels[0].modelAttributes,
      role: 'vehicle owner',
      planType: this.planType
    };
    const page: ProductCatalogPostPagination = {
      page: this.pageNo
    };
    this.productCatalogService.compatibleProducts(data, page.page).subscribe(
      response =&gt; {
        for (let i = 0; i &lt; response.products.length; i++) {
          this.lists.push(response.products[i]);
        }
        this.pageCount = response.totalCount;
      },
      error =&gt; {
        console.log(error);
      }
    );
  }
  </code></pre>
  
  <p>on filter function i am making try to make the list empty</p>
  
  <pre><code>onSelectedChange($event) {
    this.lists = [];
    this.planType = $event[0]
    this.ngOnInit();
  }
  </code></pre>
  
  <p>but i am still the previous subscribe data along with the new data. Any inputs is highly appreciated </p>