title: AngularJs service returns full object, but returns undefined when i try to access property
body: <h3>UPDATE 2:</h3>
  
  <p>I found out where the problem was coming from and I left out the important part.</p>
  
  <p>I'm setting the property in the first controller INSIDE this</p>
  
  <pre><code>$rootScope.$on('anEvent', function (event, data) {
      InjectedService.setToken(data.value);
  })
  </code></pre>
  
  <p>But I can't grab it from outside that callback scope. The event that is listened for depends on an $http request so I'm guessing that is the problem. Are there any workarounds to this?</p>
  
  <h3>UPDATE:</h3>
  
  <p>The order of controllers are the other way around so that the code in secondController is actually being called first in my actual app. I have reordered them accordingly</p>
  
  <h3>Question:</h3>
  
  <p>I'm trying to grab the services specific property but when I try to grab the service property, I get undefined (using a getter function or not). But when I try to grab the full service, I get everything with the correct property and value.</p>
  
  <p><b>main.js</b></p>
  
  <pre><code>angular.module('myApp', ['myModule', 'myServices'])
      .controller('firstController', ['InjectedService', function(InjectedService) {
  
              InjectedService.setProperty('Hello World')
  
      }])
  </code></pre>
  
  <p><b>othermodule.js:</b></p>
  
  <pre><code>angular.module('myModule', [])
      .controller('secondController', ['InjectedService',
          function (InjectedService) {
  
              console.log(InjectedService); // Full object with property == 'hello world'
              console.log(InjectedService.property); // I get undefined
              console.log(InjectedService.getProperty()); // I get undefined
  
              // interesting to note:
              InjectedService.setToken('A different string');
              console.log(InjectedService.property); // I get 'A different string'
              console.log(InjectedService); // Full object with property == 'Hello World' which was set in second controller
  
          }])
  </code></pre>
  
  <p><b>services.js:</b></p>
  
  <pre><code>angular.module('myServices', function
      .service('InjectedService', function(){
          var Service = this;
  
          Service.setProperty = function (value) {
              Service.property = value;
          }
  
          Service.getProperty = function () {
              return Service.property;
          }
  
          Service.unsetProperty = function () {
              Service.property = null;
          }
  
          return Service;
      })
  </code></pre>
  
  <p>It seems to me a scope problem, but the variable isn't a primitive type. Any suggestions?</p>