title: convert angular $q.defer().promises to Angular 5
body: <p>I realized that I can make sure of Promise.resolve to convert an Angular JS $q.defer() logic. However, I got the following problem:</p>
  
  <p>Original Angular JS:</p>
  
  <pre><code>service.validValues = function(id,name) {
      var deferred = $q.defer();
      $q.all([service.check_id(id), service.check_name(name)]).then(
          function(student){
              service.validStud(student[0], student[1]).then(function(valid) {
                  deferred.resolve(valid);
              });
          });
      return deferred.promise;
  };
  </code></pre>
  
  <p>my code:</p>
  
  <pre><code>validValues(id, name) {
      let deferr = new Promise(deferred);
      function deferred(resolve, reject) {
          Observable.forkJoin([this.check_id(id), this.check_name(name)]).subscribe((student) =&gt; {
          this.validStud(student[0], student[1]).then(function(valid) {
              resolve(valid);
              });
          });
       return deferr;
  }
  </code></pre>
  
  <p>Is it wrong? Cause I never got the valid values. Although the code can be compiled but I always got "undefined" for 'deferr' when I do a console.log.</p>
  
  <p>Thank you so much! </p>