return response.data value of $http in a function?
<p>I try to call $http service within functions so I don't get nested callbacks. Without function scope it look like this:</p>

<pre><code>      $http.post('/verify_stripe_token', {email:$routeParams.email,token:$routeParams.t})
      .then(function(response) {
        console.log(response.data) // return 1
      });
</code></pre>

<p>I want to use if(valid_token() == 1){} so I tried</p>

<pre><code>function valid_token(){
      $http.post('/verify_stripe_token', {email:$routeParams.email,token:$routeParams.t})
      .then(function(response) {
        return response.data;
      });
    }
</code></pre>

<p>Nothing worked? I do console.log(valid_token()) I got undefined.</p>