So I'm using jQuery to select some elements in an angular post-link function. Only problem is, jQuery can't find any children.
var tr = tbl.find('> thead > tr');
console.log('th', tr.children('th').length, tr.children().length, tr[0].children);
Output:
What gives?
EDIT
Here's the HTML essentially
<table my-directive>
<thead>
<tr>
<th sorting-header="foo">foo</th>
<th sorting-header="foo">foo</th>
<th sorting-header="foo">foo</th>
<th sorting-header="foo">foo</th>
<th sorting-header="foo">foo</th>
<th sorting-header="foo">foo</th>
<th sorting-header="foo">foo</th>
</tr>
</thead>
...
</table>
EDIT 2
I think I'm running into some type of race condition. Like I said I didn't write the original directive, I'm just tweaking it. It seems that when I'm handed the tbl
element the table doesn't have the elements in it yet (so I suppose) because a tr[0].innerHTML
spits out a bunch of <!-- ngIf:
clauses but no elements. I guess this is some spooky race condition.
Thanks for all the help everyone, I'm just going to go about this a different way now I guess.