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]> 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].
> 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.
>



-- 
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