title: Get the first item in a json array in angular?
body: <p>I am trying to get the first item in a json array that i get from a web service i call with a factory.</p>
  
  <p>My controller:</p>
  
  <pre><code>CreateProjectIndex.controller('GroupCtrl', ['$scope', 'GetGroups',
  function($scope, GetGroups){
     $scope.groups = GetGroups.getGroups();
     console.log($scope.groups);
     console.log($scope.groups[0]);
     $scope.group1 = $scope.groups[0];
  }]);
  </code></pre>
  
  <p>My service: </p>
  
  <pre><code>'use strict';
  var Groups = angular.module('GroupsService', ['ngResource']);
  
  Groups.factory('GetGroups', ['$resource',
  function($resource){
      return $resource('../../../api/Groups/GetGroups', {}, {
          getGroups : {method : 'GET', params:{}, headers: {'Accept': 'application/json;charset=UTF-8'}, isArray : true}
      });
  }]);
  </code></pre>
  
  <p>the "console.log($scope.groups);" returns: </p>
  
  <pre><code>[$promise: Object, $resolved: false]
  0: Resource
      groupId: "361552"
      groupName: "1"
      __proto__: Resource
  &gt;1: Resource
  &gt;2: Resource
  &gt;3: Resource
  &gt;4: Resource
  &gt;5: Resource
  $promise: Object
  $resolved: true
  length: 6
  __proto__: Array[0]
  </code></pre>
  
  <p>While the " console.log($scope.groups[0]);" just returns "undefined". </p>
  
  <p>Is there any way to get the first item in that object? </p>