Подтвердить что ты не робот

Найти строку ошибок в приложении AngularJS

Я только начал играть с AngularJS, и я получил ошибку ниже.

Error: Argument '?' is not a function, got Object
at assertArg (http://localhost/angular/project/scripts/vendor/angular.js:1039:11)
at assertArgFn (http://localhost/angular/project/scripts/vendor/angular.js:1049:3)
at http://localhost/angular/project/scripts/vendor/angular.js:4802:9
at http://localhost/angular/project/scripts/vendor/angular.js:4384:17
at forEach (http://localhost/angular/project/scripts/vendor/angular.js:137:20)
at nodeLinkFn (http://localhost/angular/project/scripts/vendor/angular.js:4369:11)
at compositeLinkFn (http://localhost/angular/project/scripts/vendor/angular.js:4015:15)
at compositeLinkFn (http://localhost/angular/project/scripts/vendor/angular.js:4018:13)
at publicLinkFn (http://localhost/angular/project/scripts/vendor/angular.js:3920:30)
at update (http://localhost/angular/project/scripts/vendor/angular.js:14202:11) 

Теперь, мой вопрос: есть ли способ найти строку в файле .js, где произошла ошибка? Я получаю номер строки в файле angular.js на повышенном исключении, но слишком много файлов, где может произойти ошибка.

Я попытался с помощью AngularJS Batarang, но это больше для отладки семантических, а не синтаксических ошибок.

Спасибо.

4b9b3361

Ответ 1

Это будет проще, если вы свяжетесь с файлами js, которые вызвали бы эту ошибку.

Из источника angular.js https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js это похоже на проблему с созданием экземпляра контроллера.

Здесь строка, вызывающая ошибку утверждения:

/**
 * @ngdoc function
 * @name ng.$controller
 * @requires $injector
 *
 * @param {Function|string} constructor If called with a function then it considered to be the
 *    controller constructor function. Otherwise it considered to be a string which is used
 *    to retrieve the controller constructor using the following steps:
 *
 *    * check if a controller with given name is registered via `$controllerProvider`
 *    * check if evaluating the string on the current scope returns a constructor
 *    * check `window[constructor]` on the global `window` object
 *
 * @param {Object} locals Injection locals for Controller.
 * @return {Object} Instance of given controller.
 *
 * @description
 * `$controller` service is responsible for instantiating controllers.
 *
 * It just a simple call to {@link AUTO.$injector $injector}, but extracted into
 * a service, so that one can override this service with {@link https://gist.github.com/1649788
 * BC version}.
 */
return function(constructor, locals) {
  if(isString(constructor)) {
    var name = constructor;
    constructor = controllers.hasOwnProperty(name)
        ? controllers[name]
        : getter(locals.$scope, name, true) || getter($window, name, true);

====== > assertArgFn (конструктор, имя, истина);     }

  return $injector.instantiate(constructor, locals);
};

Невозможно найти конструктор для контроллера.