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 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