jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 294 forks source link

NoReverseMatch at /angular/reverse/ #191

Closed besenthil closed 9 years ago

besenthil commented 9 years ago

Team,

I am pretty much stuck with this issue.

NoReverseMatch at /angular/reverse/ Reverse for 'check_url' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'$check_url/$']

And my settings.py looks like this

INSTALLED_APPS = ( ................. 'djangular', )

MIDDLEWARE_CLASSES = ( 'djangular.middleware.DjangularUrlMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', )

In my html, i have included

and I use the controller...

<div ng-controller="SignupController">

</div>

and in my controller javascript, I make this call

myapp.controller('SignupController', ['$scope','$http','djangoUrl',function($scope, $http, djangoUrl) { $scope.checkEmailAvailability = function() { console.log('Called'); var fetchItemURL = djangoUrl.reverse('gateway:check_url'); console.log(fetchItemURL); $http.get(fetchItemURL).success(function(item) { console.log('Fetched item: ' + item); }).error(function(msg) { console.error('Unable to fetch item. Reason: ' + msg); }); } $scope.checkEmailAvailability(); }]);

How can I make django use /angular/reverse in my urls? Am I doing something wrong here?

besenthil commented 9 years ago

Closing the issue as it got resolved once I changed my urls. py by removing the $

old url(r'^$', include('gateway.urls',namespace="gateway")), new url(r'^', include('gateway.urls',namespace="gateway")),