title: subscribing issue after Injecting another service in service in angular rxjs
body: <p>I have one service class <strong>NetworkService</strong> where I put all general <strong>rest api requests like get, put, post, delete</strong> etc and <strong>all other services</strong> are using this  <strong>NetworkService</strong>  methods for performing operation. Currently, I am <strong>subscirbing</strong> to the methods of <strong>NetworkService</strong> in all <strong>other services</strong>. I would like to know is there a better way of doing it so that i can do subscription in component instead in other services. For example for login I am using a method of <strong>AuthenticationService</strong> which is <strong>subscribing</strong> to the method of <strong>NetworkService</strong>
  :</p>
  <p>AuthenticationService method:</p>
  <pre><code>doLogin(loginData) {
   let loginParams = {
     client_id: &quot;app&quot;,
     grant_type: &quot;password&quot;,
     password: btoa(loginData.password),
     username: loginData.username,
   };
  
   this.networkService.postGetToken(loginParams).subscribe(
    (data) =&gt; {
      this.onPostGetTokenSuccess(data);
    },
    (error) =&gt; {
      this.onPostGetTokenError(error);
    }
   );
  </code></pre>
  <p>}</p>
  <p>NetworkService method:</p>
  <pre><code>postGetToken(dataParam) {
     //Used only for Login
     let options = {
       headers: {
         &quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;,
       },
     };
  
     let data = { params: dataParam };
  
     return this.http
       .post(
         this.baseurl +&quot;svf/zsv/oauth/oauth20/token&quot;,
      data,
      options
    )
    .pipe(
      map(
        (data) =&gt; {},
        (error) =&gt; {}
      )
    );
   }
  </code></pre>
  <p>In <strong>login component</strong> I can not subscribe to the <strong>doLogin</strong> method of <strong>AuthenticationService</strong>  as in AuthenticationService  I am already subscribing to the method of <strong>NetworkService</strong>  and it is difficult to get result in <strong>login component</strong>. In login component I am doing it as follow :</p>
  <pre><code>performlogin() {
     if (!this.loginForm.valid) {
      return false;
     } else {
     this.loaderService.showLoader();
  
    let data = this.authenticationService.doLogin(this.loginForm.value);
     if (data[&quot;access_token&quot;]) {
     
     } else {
     }
    }
  }
  </code></pre>
  <p>If someone know a better way tpo do it then please share it here. Thanks</p>