I want to iterate through $scope variables with a for loop like this. In this example the $scope object includes an object accounts inlcuding 5 objects, whose name
If accounts is an array, you can use the array indexer:
for(var i = 1; i < 5; i++){ $('#name').val($scope.accounts[i].name); }