title: How to return data as Promise type in Angular 2?
body: <p>How to return data as Promise type in Angular 2?</p>
  
  <p>Using this function I need to return data as promise type:</p>
  
  <pre><code>private getStudyPeriods(): Promise&lt;CurrentPeriod&gt; {
      let data = [];
      return data;// here
   }
  </code></pre>
  
  <p>I tried last variant like this:</p>
  
  <pre><code>public getStudyPeriods(): Promise&lt;Period[]&gt; {
      return this.education.get(7).then((data: any) =&gt; {
        if (!data.hasOwnProperty('errors')) {
          this.periods = data;
          return new Promise((resolve, reject) =&gt; {
            resolve(this.periods);
          });
  
        }
      })
    }
  </code></pre>