title: Protractor "TypeError: Cannot read property of undefined"
body: <p>I am doing a test using Protractor. I have the following in my test code:</p>
  
  <pre><code>exam.name = element(by.id('name'));
  exam.version = element(by.id('version'));
  
  exam.controls = [
      { id: exam.name,      name: 'Name',     control: 'input box' },
      { id: exam.version,   name: 'Version',  control: 'input box' }
  ];
  
  
  modal.controlIsPresent = function (data) {
      for (var x = 0; x &lt; data.length; x++) {
              it('Find a\\an ' + data[x].name + ' ' + data[x].control, function () {
                  expect(data[x].id.isPresent());
              });
      }
  }
  
  modal.controlIsPresent(exam.controls);
  </code></pre>
  
  <p>But when I run my test I am getting an error "TypeError: Cannot read property 'id' of undefined". It is getting the name and control okay. Can someone point out to me what Im doing wrong? Thanks.</p>
  
  <p>What I want to see when I run the test is the following:</p>
  
  <pre><code>Find a\an Name input box
  Find a\an Version input box
  </code></pre>