title: Pipe vs Subscribe in Angular
body: <p>I hope everyone just doing fine. Can, please someone clearly explains which one to choose among <strong>pipe</strong> and <strong>subscribe</strong>, and why? when it comes to not only getting the response but also to initialize some other variables or make changes to the boolean variables.</p>
  
  <p><strong>Also have a look at the code. Is it the right way to do it?</strong> </p>
  
  <pre><code>public getAlbums(){
      this.enableLoader = false;
      this.albumHttpService.getAlbums()
          .pipe(
              map((response) =&gt; {
                  this.enableLoader = false;
                  if (!response.albums.length) {
                      this.noDataSet = true;
                      if (response.albums === null) {
                          this.list = [];
                      }
                  }
                  else{
                      this.noDataSet = false;
                      this.list = response.albums;
                  }
              }),
              catchError((error) =&gt; {
                  this.noDataSet = false;
                  this.data = [];
                  throw new Error(error);
              }) 
          )
          .subscribe();
  }
  </code></pre>
  
  <p>Thanks in advance</p>