Error Not Captured: [$rootScope:infdig]

Here is a code snippet that I wrote:

<tbody ng-repeat="dtataOne in dataOnes()">
    <tr>
        <td>My Data</td>
        <td class="task-container ui-sortable" colspan="6" ng-model="dtataOne.MyModel" ui-sortable="sortableOptions" stafflastname="{{'Pup-Only'}}" data2="{{'999999'}}" task="{{100}}" data3="{{'No'}}">
          <a href="javascript:void(0);"  ng-repeat="tg in Getdata(data3)" ng-click="ShowData(tg)">{{tg.count}}</a>
        </td> 
   </tr>
</tbody>

I also have a controller function:

$scope.Getdata = function(data3) {
    var datas = [];       
    data3.forEach(function (staff) {
        if (true) {
            staff.tgs.forEach(function (tg) {
                datas.push(tg);
            });
        } 
    });

    $scope.data3s().forEach(function (datum) {
        if (datum.id === data3.id) {
            datum.MyModel = datas;
        }
    });
    return datas;
};

While working on this code, I encountered an error in the line "datum.MyModel = datas;" which resulted in the following message:

Uncaught Error: [$rootScope:infdig] http://errors.angularjs.org/1.2.13/$rootScope/infdig?p0=10&p1=%5B%

If anyone can provide assistance with resolving this issue, it would be greatly appreciated.

Answer №1

During each digest cycle, the function GetData(data3) will be executed. Within this function, you are modifying datum.MyModel, triggering a new digest cycle. If this process occurs more than 10 times, an error will occur.

In short: avoid using functions within an ngRepeat expression.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it necessary to use asynchronous actions in Node.js only when developing server applications?

In the Node.js application I'm developing, there is a piece of code similar to this within an async function: await a(param1); await b(param2); await c(param3); await d(param4); From my understanding, this setup works well for a server-based app. Fo ...

A guide to monitoring and managing errors in the react-admin dataProvider

Rollbar has been successfully integrated into my react-admin app to track uncaught errors. However, I've noticed that errors thrown by the dataProvider are not being sent to Rollbar. It seems like errors from the dataProvider are internally handled w ...

Update the value of a scope variable directly within a controller. Subsequently making a function call

Hey there, I just want to start by saying sorry in case this question has already been asked or if it seems silly. I'm pretty new to AngularJS and have managed to overcome CORS errors, set up login via Parse, and even created an API for my app using ...

How to integrate external JavaScript files with Angular CLI and Webpack

I'm facing a challenge on how to incorporate JS files (vendors) after transitioning Angular Cli from SystemJs to Webpack. For instance Option A I have npm-installed js files. Simply adding script tags to the head tag doesn't work, and it doesn ...

Observing changes in a parent component variable with Angular

One feature of my form is that it consists of a parent component and a child component. To disable a button within the form, I utilize a function called isDatasetFilesValid() which checks a specific variable (datasetList[i].fileValid). This variable is mo ...

Struggling with transferring a value between two input fields using jQuery

I'm currently working on a project to create a simple "to-do list" and I've encountered an issue that seems pretty basic. I am trying to pass the main input from #myInput at the top, down to the next line below, but I'm facing some challenge ...

When working with a barcode font in Chrome, using style.fontFamily may not be effective, but utilizing className can achieve the desired result

Take a look at this HTML snippet: <style> .barcode { font-family: 'BC C39 3 to 1 Medium'; } </style> <div><span id='spn'>1234567</span></div> This code will apply a barcode font style: <script> ...

Finding out which element is currently in focus in Internet Explorer 11 requires a few simple steps

Is there a way to determine which element is going to receive focus when the focusout event is triggered in Chrome and IE 6-10, or when the blur event is triggered in Firefox? $(input).focusout(function (event) { "use strict"; cons ...

To achieve the desired format, where should I press or manipulate the information?

I need help with manipulating arrays to generate a specific JSON file structure. I've made some progress but got stuck at this point: var T_nn_IN = document.getElementById('datatablenewname'); var tabledata_newname_initialname = []; ...

What is the best way to create a navigation bar that opens on the same page when clicked?

Can someone help me figure out how to create a navbar that, when clicked, opens a small window on the same page like in this example image? ...

What is the best way to retrieve the value of a cell in the parent gridview while navigating through the child gridview?

I am facing an issue with a JavaScript function that is used to expand and collapse a child gridview inside its parent gridview. My problem arises when I try to retrieve the value of a specific cell in the current row of the parent gridview, or even just i ...

Looking to create a format for displaying short comic strips in a grid pattern

I am struggling to create an image grid for my small comics. I want to have 2 columns and 3 rows, but all the divs end up in the same place. I tried using display: flex, but it didn't work as expected. Additionally, I want the grid to be responsive, b ...

Retrieve the node-postgres result and store it in a separate object beyond the callback function

Currently, I am in the process of converting a data profiling script originally written in Python to JavaScript while following the Wes Bos beginner Javascript Course. This script is designed to take database connection details and a specified target tabl ...

Prevent automatic scrolling by clicking when you reach the bottom

In order to replicate the issue I am experiencing, please click on the down button four times, and then click on the up button. You will observe that you need to click the up button one extra time for it to function properly. How can I detect when it has r ...

Troubleshoot redirect issues in JavaScript or PHP

I am facing a simple issue that is proving to be time-consuming to solve. The challenge that I am encountering involves an HTML form with 2 buttons. Here is the relevant code snippet: $html1 = "<div class='pai-forms'> <form ...

What is the best way to create a sign-up box that appears on the same page when you click on the sign-up button

I am interested in implementing a 'sign up' box overlay at the center of my index page for new users who do not have an account. I would like them to be able to easily sign up by clicking on the 'sign up' button. Once they complete the ...

Angular SEO: Optimizing Your Website for Search Engines with Google Webmaster Tools and Prerender.io Integration on a Node.js Server

Despite diligently following documentation and tutorials on how to set up a prerender.io server on Heroku, I am still facing issues with GWT fetching and rendering my site without the data. I have made sure that prerender.io is caching the pages correctly ...

What is the best way to run code when an iFrame's onload event is triggered?

I am currently using Ace () to transfer code from an editor and run it within an iFrame. However, I am facing a problem when trying to inject the following code snippet: Code in Editor <script type="text/javascript"> window.onload = function() ...

Tips for accessing arrayList data within a loop in JavaScript and displaying it in an HTML <c: forEach> tag

I have an array list stored inside a javascript code block. I am looking to extract this array list and iterate through it using the html tag <c:forEach>. How can I achieve this? Currently, I am able to display the array list using <h:outputText&g ...

The background image spanning across the entire screen, not just confined to the center

view image details here Can anyone explain why my background image for the main game is displaying like this? I want to set it for the entire screen as I have different backgrounds planned for the menu of the game and the game itself. Any suggestions to ma ...