title: Restangular: Waiting for resolve of promise?
body: <p>I'm new to Javascript and AngularJS and this one makes me scratch my head :/</p>
  
  <p><strong>Precondition</strong>  </p>
  
  <ul>
  <li>A REST Service providing my data from the backend </li>
  <li>AngularJS 1.2.21 and Restangular 1.4.0</li>
  <li>An AngularJS controller, that shall ask the service for a spiced up version of the provided </li>
  </ul>
  
  <p><strong>What I have</strong>  </p>
  
  <p>This is the method in question:</p>
  
  <pre><code>   service.getSlices = function() {
  
          Restangular.all('entries').getList().then(function(entries) {
  
              //some rather complex modification of the backend data go here
              //...
  
              return  resultOfModification; //this is what should be returned for getSlices();
          })
  
          //I want the resultOfModification to be returned here
  
  
      };
  </code></pre>
  
  <p><strong>The question</strong></p>
  
  <p>Bascially I would like to wait in <code>getSlices()</code> until the promise is resolved in order to return my <code>resultOfModification</code> only when it actually is calculated.</p>
  
  <p><em>Additional scenario</em><br>
  I could also image to return a promise from <code>getSlices()</code> which would then provide the <code>resultOfModification</code>. However I fear I do not understand this well enough and / or am too frustrated / tired meanwhile.</p>
  
  <p>Answers and any suggestions are welcome, especially pointers to good reading material. Thanks</p>