title: Ember set value in object of array from Service
body: <p>I'm trying to set the attribute 'show' of an object, that comes from an array which is served by a service.</p>
  
  <p>the service (not the problem):</p>
  
  <pre><code>// services/events.js
  export default Ember.Service.extend({
  types: [
      {"code": 0, "label": 'Performance', "show": true, "css": 'warning'},
      {"code": 1, "label": 'Preview', "show": true, "css": 'danger'},
      ....
  ],
  });
  </code></pre>
  
  <p>in my controller I have an action that should update the attribute 'show':</p>
  
  <pre><code>// controller
  const { service } = Ember.inject;
  
  export default Ember.Controller.extend({
      eventsService: service('events'),
      ....
      actions: {
          setEventFilter: function(code) {
              ....
              let obj = this.get('eventsService.types').objectAt(code);
              // I get a proper Object here, that also has a set-function:
              console.log(obj);
              // this fails with 'Uncaught TypeError: obj.set is not a function':
              obj.set('show', false);
          }
      }
  });
  </code></pre>
  
  <p>I've read the answers here <a href="https://stackoverflow.com/questions/24905879/ember-set-array-value-for-specific-key">Ember: set array value for specific key</a> , tried all the possibilities, nothing worked in my case.</p>
  
  <p>What I don't understand is, that I can see the function 'set' in console, yet I still get that error:</p>
  
  <p><a href="https://i.stack.imgur.com/tL3Ng.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tL3Ng.png" alt="enter image description here"></a></p>
  
  <p>Any suggestions? Anybody got an idea what I'm doing wrong?</p>
  
  <p>I also tried:</p>
  
  <pre><code>console.log(obj.show);   // working! gives me right value
  console.log(obj.get('show'); // same error (but with get of course...)
  obj.show = false; // gives error 'Assertion Failed: You must use Ember.set() to set the `show` property (of [object Object]) to `false`.'
  </code></pre>