Angularjs – Console log Errors

TypeError: Converting circular structure to JSON

If you encounter this “TypeError: Converting circular structure to JSON”, check whether you are trying to $watch any object which has circular reference. It could be the culprit.

Uncaught Error: No module:

possible reasons:

Syntax : angular.module(name[, requires], configFn);
  • Check whether “angular.module” function is being called without optional square brackets. Basically, if the “requires” parameter is not being passed, angular will try to find the module. If the “requries” param passed, it will create the module.

  • you might face the problem when executing the unit test. If you split the angular module source across different files [ie, in only one file, ‘angular.module’ is called with ‘requires’ parameter. in other files, the module is being retrieved and updated]. In this scenario, karma.conf.js might include the js files like

‘app/js/**/*.js’

. You might get the above error, if the order of files [moduleA-part1.js, moduleA-part2.js] is changed,

Uncaught Error: 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations

possible reasons:

  • Main reason is that the function inside $digest cycle returns different value each time. For example,

    • the function inside $digest cycle, might return different object each time,
    • or you might try to randomise the return value of the function which is in $digest cycle.
  • If $watch is giving this problem, you can use the third paramter in $watch function. It makes it to compare object for equality rather than for reference. [angular doc of $watch]

This entry was posted in AngularJS. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *