JavaScript scope in angular and applied css class only on first div

I'm calling js function every 2 seconds where on certain condition I want to update div on the view.

 <div id="ball_{{ballIndex}}">{{ball}}</div>

on ng controller

       var myCounter = 0;

        var interval = $interval(function () {
            if (myCounter <= 35) {
                myCounter ++;
                DoSomething();
            } else {
                //
            }
        }, 1500);

        function setCurrentBallEffect() {
            $('#ball_' + myCounter).addClass('magictime puffIn');                
        }

        function DoSomething() {
            if (myCounter == 0) {
                $scope.ballIndex = 1;
            } else {
                $scope.ballIndex = myCounter;
            }
        }

using this code only first div in iteration is applied with class magictime puffIn. When I hardcode div id's on the view side like <div id="ball_1">1</div> <div id="ball_2">2</div> .. applied css class work on each div. What I'm doing wrong?

Update: Tried with

<div ng-attr-id="{{ 'ball_' + ballIndex }}"> </div>

but problem is still present.

Answer:1

My function below returns an object containing the sorted playerPoints passed in via the "array of objects" parameter. Without modifying the passed in array, is there a more efficient/performant way ...

My function below returns an object containing the sorted playerPoints passed in via the "array of objects" parameter. Without modifying the passed in array, is there a more efficient/performant way ...

I tried in my chrome debug console: >function m(){function toString(){return "abc"}} undefined >new m().toString() "[object Object]" I expect it to print "abc". Why?

I tried in my chrome debug console: >function m(){function toString(){return "abc"}} undefined >new m().toString() "[object Object]" I expect it to print "abc". Why?

I'm trying to implement automatic formatting to an web-page. So that when you type 12345678, it is automatically €123.456,78. <div class="form-group"> <input type="text" required class=...

I'm trying to implement automatic formatting to an web-page. So that when you type 12345678, it is automatically €123.456,78. <div class="form-group"> <input type="text" required class=...

How to set AllowColumnResize=true at client side using javascript in master pages using the CSS selector , so that it would apply to all the grid specified with . My effort- function pageLoad() ...

How to set AllowColumnResize=true at client side using javascript in master pages using the CSS selector , so that it would apply to all the grid specified with . My effort- function pageLoad() ...