Protractor filter, how to find elements within filtered elements
<p>Below is some shortened HTML that I have, and an attempt at some protractor code.</p>

<p>What I'm trying to do, is do a click on an i element. I'd like to be able to do the click, based on what the ID is, which is in a sibling element.</p>

<p>The below code doesnt work. I've also tried doing a filter inside a filter, and everything I try is causing errors. Can anyone help please? The error I get with this attempt is "Cannot read property element of undefined.</p>

<p>Can anyone help with this please? Have spent a lot of time on this so far!</p>

<p>Thanks.</p>

<pre><code>element.all(by.repeater('data in ctrl.data')).filter(function(elem){
    return elem.element(by.css('div.case-info span')).getText() == id
}).then(function(filteredElements){
    filteredElements.first().element(by.css('i.fa')).click();
});




&lt;div ng-repeater="data in ctrl.data"&gt;
    &lt;div class="case-info"&gt;
        &lt;span&gt;AN ID HERE&lt;/span&gt;
        &lt;div&gt;Other stuff here thats not really relevant&lt;/div&gt;
    &lt;/div&gt;
    &lt;i class="fa fa-red"&gt;&lt;/i&gt;
&lt;/div&gt;
</code></pre>