I am calling the class based view
class CurrentUser(APIView):
authentication_classes = (authentication.TokenAuthentication,)
def get(self, request, format=None):
for user in User.objects.all()
if request.user.is_authenticated():
fullname = user.get_full_name()
return Response(fullname)
from the url
url(r'^currentuser$', views.CurrentUser.as_view(), name='current-user'
I am getting current username. But I want to take that data into $scope of angularjs controller in following way.. Please.. Any help would be appreciated..
controllersModule.controller('homeCtrl', function($scope, $http, User , Product ,Process ,Ingredient) {
$scope.$on('event:login-confirmed', function() {
$scope.users = User.query();
$scope.products = Product.query();
$scope.processes = Process.query();
$scope.ingredients = Ingredient.query();
// $scope.currentUser = get;
});
});