TypeError: Unable to get property 'then' of undefined or null reference Angularjs Breeze
<p>I'm getting the following exception after fetching the data from the breeze controller.</p>

<blockquote>
  <p>TypeError: Unable to get property 'then' of undefined or null reference</p>
</blockquote>

<p>Here is my code:</p>

<p><strong>Student.js</strong></p>

<pre><code>function fetchUsers()
{
    return repository.GetAllUsers().then(function querySucceeded(data) {
        // Looks like the problem with the above 'then'
        vm.allUsers = data;
        return vm.allUsers;
    });
}
</code></pre>

<p><strong>repository.js:</strong></p>

<pre><code>function GetAllUsers()
{                
    var query = EntityQuery.from('users');
    manager.executeQuery(query).then(querySucceeded, _queryFailed);               

    function querySucceeded(data) {                                    
        log('Retrieved [Lookups]', data, true);    
        return data.results;  //Here I can see the fetched data from breeze controller.
    }
}
</code></pre>

<p>When I replace then with <code>to$q</code>, I see the following exception:</p>

<blockquote>
  <p>Object doesn't support property or method <code>to$q</code></p>
</blockquote>