Why does Angularjs Service Return a Character Array instead of an Array of Objects? <p>I am using a service(.factory) to hold an array of objects/items which gets updated by multiple controllers and then the data is pulled back down by each controller. Each time I add a new array of data, I push it onto the array. However, when I attempt to load an array within my controller so I can display it my view, it is returning a character array which makes it impossible to use ng-repeat to iterate over the values.</p> <pre><code>// controllers.js angular.module('myapp.controllers', []) .controller('MainCtrl', function($scope, MainService) { $scope.mainItems = MainService.all(); // Why does this return a char array? // get the count $scope.getCount = function(item){ return TempOrder.getCount(item); } // add an item $scope.addItem = function(item){ TempOrder.addItem(item); return TempOrder.getCount(item); } }) .controller('SecondaryCtrl', function($scope, MainService) { $scope.items = MainService.all(); // Why does this return a char array? // get the count $scope.getCount = function(item){ return TempOrder.getCount(item); } // add an item $scope.addItem = function(item){ TempOrder.addItem(item); return TempOrder.getCount(item); } }); </code></pre> <p>This is my service </p> <pre><code>// services.js angular.module('myapp.services', []) .factory('MainService', function() { orderItems = []; return { all: function() { return orderItems; // Why does return a char array??? }, getCount: function(item){ var count = 0; for (i = 0;i&lt;orderItems.length;i++) { if (orderItems[i] === item ){ count++; } } return count; }, addItem: function(item) { orderItems.push(item); } } }); </code></pre>