I have an empty array defined as $scope.list = [] I then select items from 
the database and push them into the array as an object like so { 
name:"john", surname:"doe, age:35 } I have stored the length of the list in 
an variable however upon deleting items or adding items to the array 
doesn't update it's length. What am I doing wrong? Here is my code

$scope.list = [];
 var scopeListLength = $scope.list.length;
 $scope.$watch(scopeListLength, function(newVal, oldVal){ 
 console.log(newVal);
 console.log(oldVal);
 if(newVal !== oldVal) scopeListLength = newVal;
 console.log("scopeListLength = " + scopeListLength);
 });

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to