title: AngularJS promise returning empty object
body: <p>Basically what I want to do, is to assign some model value from function call that resolves promise. Like so</p>
  
  <pre><code>value = someFun()
  </code></pre>
  
  <p>This is a service from which I call this function</p>
  
  <pre><code>app.factory('SomeService', function($q) {
      return {
          someFun: function() {
              var d = $q.defer();
              try {
                  d.resolve("hi");
              } catch (e) {
                  d.reject(e);
              }
              return d.promise.then(function(text){
                  return text;
              });
          }
      };
  });
  </code></pre>
  
  <p>Here is the HTML code</p>
  
  <pre><code>&lt;div ng-init="value = 'yes'"&gt;
      &lt;pre&gt;{{value |json}}&lt;/pre&gt;
  &lt;/div&gt;
  &lt;button type="button" ng-click="value = someFun()"&gt;click me&lt;/button&gt;
  </code></pre>
  
  <p>And this is in the controller</p>
  
  <pre><code>$scope.someFun = SomeService.someFun;
  </code></pre>
  
  <p>Here is plnkr</p>
  
  <p><a href="http://plnkr.co/edit/qO5ofBXZDsi3cS3bBnT8" rel="nofollow noreferrer">http://plnkr.co/edit/qO5ofBXZDsi3cS3bBnT8</a></p>
  
  <p>Right now it returns an empty object. What is wrong?</p>
  
  <p>EDIT: As already answered below, yes this is one way, but let's say I want to call SomeService.someFun in ngRepeat?</p>
  
  <p><strong>EDIT2: HERE IS THE ANSWER</strong> -> <a href="https://stackoverflow.com/questions/25329596/angular-ui-bootstrap-modal-inside-ngrepeat">Angular UI Bootstrap modal inside ngRepeat</a></p>