Hi Pablo,

Yes I have tried that I have put watches in three of my controllers, the 
add, edit and delete but on the add it still doesn't update my array. Does 
it have to be placed in a particular place to work?

On Sunday, March 27, 2016 at 4:50:04 PM UTC+2, Pablo Madalena Targa wrote:
>
> Hi friend,
>
> have you tried this?
>
> $scope.$watch('list.length', function(newValue, oldValue){...});
>
> On Sun, Mar 27, 2016 at 3:15 PM, <[email protected] <javascript:>> 
> wrote:
>
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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