I want to make a promise in my angularjs controller. I took an example from the Angularjs Doc and pasted it into my controller. When I try to run the code, the console prints:
Error: $q is not defined
Why does this error occur and how to solve it?
I tried to solve this problem, but most of the questions relate to more specific problems than mine.
A (German) tells me that promises is already implemented in angular js and there is no need to add anything to it.
EDIT:
this is my controller:
app.controller("ArgumentationController", [
'$scope', '$resource',
function($scope, $resource) {
EDIT2: Comment suggested entering $ q. I have done this:
app.controller("ArgumentationController", [
'$scope', '$resource', '$q',
function($scope, $resource, $q) {
Now the error does not occur.
source
share