I try like this:
$http({ method: \'POST\', url: \'/token\', data: { username: $scope.username, password: $scope.password, grant_type: \'password\' } }).success(f
I think, adding the header {headers: { 'Content-Type': 'application/x-www-form-urlencoded' } to your post request would do the trick. It should be something like this:
{headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
$http.post(loginAPIUrl, data, {headers: { 'Content-Type': 'application/x-www-form-urlencoded' }})