I guess I don't understand where $q comes from.  I thought you would have 
full access just like $ if you in jQuery.  
Even if I do something like this, it has to be defined somewhere else?

Application.Controllers.controller("XXX", ['$scope', '$q'], 
function($scope, $q) {




On Thursday, May 15, 2014 11:51:25 AM UTC-4, Chris Rhoden wrote:
>
> You aren't injecting $q, because your injection annotation does not 
> include it.
>
>
> On Thu, May 15, 2014 at 11:46 AM, Chris <[email protected] <javascript:>
> > wrote:
>
>> hi all,
>>
>> i'm new to angularjs, trying to use $q in a controller with no luck.  any 
>> ideas?  
>> thanks
>>
>> TypeError: Cannot read property 'defer' of undefined
>>
>>
>> Application.Controllers.controller("XXX", ['$scope'], function($scope, 
>> $q) {
>>
>> $scope.myFunc = function(){
>>  var defer = $q.defer(),
>> myPromise;
>>  
>> myPromise = $scope.getData()
>>  .then($scope.getData2)
>> .then(function(data) {
>> defer.resolve(); // resolve our defer
>>         });
>>  // return our promise
>> return defer.promise();
>>  }
>> });
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "AngularJS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> chrisrhoden 
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to