batarang icon indicating copy to clipboard operation
batarang copied to clipboard

Broken when using app.services({list of services});

Open a-lucas opened this issue 12 years ago • 1 comments

I'm using this notation to organize my controllers, services and directives.

var services={};
var controllers={};
var directives={};

services.Servicename = function($http,$q){
  return{
    get: function() {
        var deferred = $q.defer();
        //more code
  }
};

then,

  var app = angular.module('myApp');
  app.service(services);
  app.directive(directives);
  app.controller(contollers);

This works well. However, when using batarang in the console, it throws :

   TypeError: Cannot call method 'defer' of undefined

a-lucas avatar Dec 02 '13 23:12 a-lucas

Hey, I'm having this issue as well. I'm sending a list of services in a key-value object to app.service().

    var services = {
        "UserService": userService,
        "ActivityService": missionService,
        "DataService": dataService
    };
    app.service(services).

this is the error i get when batarang is enabled:

TypeError: Object [object Array] has no method 'apply'
    at new name.(anonymous function) (<anonymous>:687:32)
    at invoke (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3704:17)
    at Object.instantiate (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3715:23)
    at Object.<anonymous> (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3583:24)
    at Object.invoke (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3704:17)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3546:37
    at getService (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3667:39)
    at invoke (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3694:13)
    at Object.instantiate (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:3715:23)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js:6766:28 <div ng-view="" class="ng-scope"> 

rodikh avatar Jan 22 '14 14:01 rodikh