hi all,--i'm new to angularjs, trying to use $q in a controller with no luck. any ideas?thanksTypeError: 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 promisereturn 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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
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) {