title: Ember service is undefined after being injected into a component and used in a computed property
body: <p>I've made a relatively straight-forward Ember service and am trying to inject it into a component via the <a href="https://guides.emberjs.com/v2.5.0/applications/services/" rel="nofollow noreferrer">Ember Docs</a> and <a href="https://www.emberscreencasts.com/posts/82-introduction-to-services" rel="nofollow noreferrer">this tutorial</a>. However after injecting the service and calling one of its functions via a computed property, I get the error:</p>
  
  <pre><code>TypeError: undefined is not an object (evaluating 'this.get('businessValidator').validate')
  </code></pre>
  
  <p>I've tried using the debugger to log out this.get('businessValidator') and it returns undefined, as does using console.log. I've tried initializing the component both by name (as below) and implicitly (without the name, as it should work per the Ember docs and <a href="https://stackoverflow.com/questions/36755816/emberjs-service-is-undefined-after-loading">unmarked solution here</a>). The model passed to the component is the business the businessValidation service needs to validate. I've done plenty of unit testing on the service itself.</p>
  
  <p><strong>/components/production-checker.js:</strong></p>
  
  <pre><code>import Ember from 'ember';
  
  export default Ember.Component.extend({
    businessValidator: Ember.inject.service('business-validator'),
    doesBusinessValidate: Ember.computed('model', function() {
       if (this.get('businessValidator').validate(this.get('model'))) {
        return "Ready for business!";
       } else {
         return "Production is halted!";
       }
    })
  });
  </code></pre>
  
  <p><strong>services/business-validator.js:</strong></p>
  
  <pre><code>import Ember from 'ember';
  
  export default Ember.Service.extend({
    init() {
      this._super(...arguments);
    },
    validate(business) {
      let validMarkets = this.validateTargetMarkets(business);
      let validChosenProduct = this.validateChosenProduct(business);
      let validSuppliers = this.validateRequiredSuppliers(business);
      let validPrice = this.validatePrice(business);
      let validWorkers = this.validateWorkers(business);
      let validLocations = this.validateLocations(business);
      if (validMarkets &amp;&amp; validChosenProduct &amp;&amp; validSuppliers &amp;&amp; validPrice &amp;&amp; validWorkers &amp;&amp; validLocations) {
        return true;
      } else {
        return false;
      }
    },
    validateTargetMarkets(business) {
      if (business.get("targetMarkets") &amp;&amp; business.get('targetMarkets').get('length') &gt; 0) {
        return true;
      } else {
        return false;
      }
    },
    validateChosenProduct(business) {
      if (business.get("chosenProduct")) {
        return true;
      } else {
        return false;
      }
    },
    validateRequiredSuppliers(business) {
      let result = false;
      if (business.get("chosenProduct") &amp;&amp; business.get("chosenProduct").get("requiredResources") &amp;&amp; business.get("chosenProduct").get("requiredResources").length &gt; 0) {
        result = business.get("chosenProduct").get("requiredResources").every(function(item) {
          if (item.get('chosenSupplier')) {
            return true;
          } else {
            return false;
          }
        });
      }
  
      if (result) {
        return true;
      } else {
        return false;
      }
    },
    validatePrice(business) {
      if (business.get('chosenProduct') &amp;&amp; business.get('chosenProduct').get('price') &amp;&amp; business.get('chosenProduct').get('price') &gt; 0) {
        return true;
      } else {
        return false;
      }
    },
    validateWorkers(business) {
      if (business.get('workers') &amp;&amp; business.get('workers').get('length') &gt; 0) {
        return true;
      } else {
        return false;
      }
    },
    validateLocations(business) {
      if (business.get('locations') &amp;&amp; business.get('locations').get('length') &gt; 0) {
        return true;
      } else {
        return false;
      }
    }
  
  });
  </code></pre>
  
  <p>Ember version:</p>
  
  <pre><code>Ember      : 2.5.1
  Ember Data : 2.5.2
  jQuery     : 2.2.3
  </code></pre>
  
  <p>Thanks for any help!</p>