Using ngDreamFactory module: Getting error “TypeError: Cannot read property 'login' of undefined”


I am trying to to loggin using the ngDreamFactory angular module but I getting a “TypeError: Cannot read property ‘login’ of undefined”.

I use
AngularJS - Version 1.2.24
angular-dreamfactory - Version ??? (Current)


module.controller('AppCtrl', function ($scope, $log, DreamFactory, ApartmentService, APP_CONFIG) {
    $scope.creds = {
        email: 'APP_CONFIG.userName',
        password: 'APP_CONFIG.password'

    $ = [];
    $scope.getApartments = function () {
            function (result) {
                $ = result;
            function (reject) {

    // Error: 
        function (data) {
  'Login success');
        function (error) {
  'Login failed')

Any idea ?

It doesn’t appear the module was able to pull your API.
No other errors in the console?

Hi, I’m having the same problem, I’m just getting into DreamFactory and trying to get the Trivia App example to work, using the free cloud DSP and have followed the instructions precisely. My JS console error is:

TypeError: undefined is not a function
    at _formatAndCreateJsonObj (
    at wrappedCallback (
    at Scope.$eval (
    at Scope.$digest (
    at Scope.$apply (
    at done (
    at completeRequest (
    at XMLHttpRequest.xhr.onreadystatechange ( undefined angular.js:10061

When I try to make a single call to the movies API like this:


I get the following error:

TypeError: Cannot read property 'getMovie' of undefined
    at new <anonymous> (
    at invoke (
    at Object.instantiate (
    at link (
    at nodeLinkFn (
    at compositeLinkFn (
    at publicLinkFn (
    at boundTranscludeFn (
    at controllersBoundTransclude ( <div data-ng-view="" class="ng-scope"> 

Hope you can help!

Most certainly. When your app loads, do you see the requests for /rest/api_docs/{resource} all coming back with 200 OK?

db, files, email come back 200 OK,
movies?q=Charly GET comes back 200,
movies?q=Charly OPTIONS comes back 204 no content

Cheers for the fast reply!

Sorry, wasn’t checking the whole list, basically all the standard api’s come back 200 OK, OPTIONS calls come back 204.

Options are fine as long as the request eventually passes pre-flight and GETs the url, which appears is fine here.

Are you using a hosted DSP or running a bitnami install? Just so I can tell what version we’re testing.

I’m using the free hosted DSP at

Ok, let me try and reproduce with a new cloud instance.
Can you send me your DSP name so I can peak at your config?


Config looks good. Can you assign one app to the role you have set for guest users, and let me know the app name for it? I’ll try and pull your api docs.

The guest users have the role “Trivia Users”, and this role is assigned to the app “trivia”. The Live API Doc all works fine from the Launchpad. Ah! I just now pressed “Update” on the Trivia Users role, and now there are no assignments under Service Access and System Access. I’ll add that stuff and see if that fixes it.

EDIT: Nope, the access was there, it just reverted to an empty role when I pressed update.

Yeah it went back to Create mode.

I’m running the Angular SDK against your machine and can make calls to the db , so its definitely built, let me modify my code to use the app name you gave me.

It looks like your service config has getMovies defined, not getMovie , try changing that.

getMovie is the name of the function in the Trivia App Services code, but this in turn calls DreamFactory.api.movies.getMovies({“q”: _generateSearchTerm()}, so I think the naming should be all right?

EDIT: I see your point, I can try a direct call using getMovies…

I pulled your services down, and by changing the name in the app to getMovies, the request fired successfully.

Was that done with angular-dreamfactory (or indeed the sample angular Trivia app)? I tried adding the line:


inside the controller, and this gives the error

TypeError: Cannot read property 'getMovies' of undefined

I might just be not understanding things with the angular-dreamfactory module, but it seems like DreamFactory.api.movies returns something undefined.

Good point, let me grab that codebase instead of just writing my own test with angular-dreamfactory.

Furthermore, I now noticed from the console that I’m actually getting a valid response from a movies query (Rocky, to be precise), but it’s still returning this error so there’s something fishy with the angular code.

Ah, I see now that I didn’t quite understand how to use the library, I shouldn’t call it like


, instead I should have a callback function for success/failure. But this doesn’t explain why things aren’t working with the original unmodified app.