ng-repeat does not update values from scope

71 views
Skip to first unread message

Gokul Jeyapaul

unread,
Jun 14, 2013, 12:26:37 PM6/14/13
to ang...@googlegroups.com
Hi all,

 I am an angular-js beginner.

 I am trying to do a static screen with toggle option. I have a set of json values as array in a scope variable and I add one more value to it. And, I see that the table which I form using ng-repeat is not getting updated.

 I tried using $scope.$apply and I got an error saying the apply was already in progress.

 The plunker for the code is as follows,

http://plnkr.co/HG7URndPpzzunPXkCSxD

 The code snippet for my controller is as follows,

 //Add controller
app.controller('experienceController',['$scope', '$http', function($scope, $http){
   
    init();
   
    $scope.isCollapsed = true;
   
    function init(){
      $http.get('experiences.json').success(function(data) {
        $scope.experiences = data.experiences;
      });
      }
     
   
    $scope.add = function(experienceForm){
      $scope.experiences.push(experienceForm);
      init();
      console.log("Initialized");
      console.log($scope.experiences);
      //$scope.$apply($scope.experiences);
    };
   
  }]);

 So the add function here does not work as expected.
 
 Thanks a bunch for your time. Any help on this will be greatly appreciated.

Cheers,
Gokul

Gokul Jeyapaul

unread,
Jun 16, 2013, 3:45:39 AM6/16/13
to ang...@googlegroups.com
Hi,

 Sorry for asking again, I am still facing the same issue. Any help on this would be greatly appreciated.

Thanks,
G
Reply all
Reply to author
Forward
0 new messages