title: AngularJS access object field in controller
body: <p>So i got this AngularJS controller where i need to use 2 different services <code>Project</code> and <code>Subproject</code>. One is linked to the other by <code>project_id</code> field. The code is as follows:</p>
  
  <pre><code>bonsControllers.controller('SubprojetDetailCtrl', ['$scope', '$routeParams', 'Project', 'Subproject',
    function($scope, $routeParams, Project, Subproject) {
  
      $scope.subproject = Subproject.queryFalse({projectId: $routeParams.id});     
  
      $scope.project = Project.queryFalse({projectId: $scope.subproject.project_id});
  }]);  
  </code></pre>
  
  <p>The problem is when I use in <code>$scope.project</code> or even using it on console.log, the value for <code>$scope.subproject.project_id</code> is undefined.</p>
  
  <p>The services.js code is :</p>
  
  <pre><code>    var bonsServices = angular.module('bonsServices', ['ngResource']);
  
      bonsServices.factory('Project', ['$resource',
      function($resource) {
          return $resource(URL_API + '/projects/:projectId', {}, {
              queryTrue: {method: 'GET', params: {projectId: ''}, isArray: true},         
              queryFalse: {method: 'GET', params: {projectId: ''}, isArray: false},           
              save: {method: 'POST', headers: {'Content-Type': 'application/json'}, isArray: false},
              'delete': {method: 'DELETE', params: {projectId: ''}, isArray: false},
              update: {method: 'PUT', params: {projectId: ''}, headers: {'Content-Type': 'application/json'}, isArray: false}
          });
      }]);
  
  
  bonsServices.factory('Subproject', ['$resource',
      function($resource) {
          return $resource(URL_API + '/subprojects/:projectId', {}, {         
              queryFalse: {method: 'GET', params: {projectId: ''}, isArray: false}
          });
      }]);    
  </code></pre>
  
  <p>And the template code is :</p>
  
  <pre><code>&lt;div &gt;
      &lt;span&gt;Client :&lt;/span&gt; {{project.client.name}} &lt;br /&gt;
      &lt;span&gt;Projet :&lt;/span&gt; {{project.name}} &lt;br /&gt;
      &lt;span&gt;Sous Projet :&lt;/span&gt; {{'Saison ' + subproject.saison}} &lt;br /&gt;
      &lt;span&gt;Type :&lt;/span&gt; {{project.type}} {{subproject.project_id}}&lt;br /&gt;
      &lt;span&gt;Nature :&lt;/span&gt; {{subproject.nature}} &lt;br /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In Firebug I can see clearly all $scope.subproject's elements, including project_id</p>
  
  <p>I would very much apreciate if you guys can give me a hint on this issue.</p>
  
  <p>Thanks</p>