Hi,

I am trying to put some functionality into a service what I am doing is 
defining and empty array var factoryList = []; Then in a for loop I am 
iterating through rows in a database and populating the array. I then want 
to return the length of the array from the service. this is what I have in 
the return object

 return {
    returningListLengthFunction: function(){
      return factoryListLength;
    }
 }

the factoryListLength = factoryList.length

Is there a particular way that I can access the factoryListLength variable 
from any of my controllers? I also discovered that you can't add $scope to 
a service as this will throw an error, the reason why I wanted this was so 
that I could $watch for changes in the array's length whenever a new item 
is added looks like I will now have to do this from the controller - and 
advice?

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