title: How to check if element with ID exists in AngularJS
body: <p>How can I check if an element with a specific ID already exists in my DOM inside an Angular directive? By using <code>angular.element()</code> an element is created if one does not exist, for example <code>angular.element('someID')</code> will return an element whether one already exist or not.</p>
  <p>What I am doing now as a workaround is using the <code>.html()</code> jqLite function like this:</p>
  <blockquote>
  <p>if(angular.element('#someElementID').<strong>html()</strong>) {</p>
  <blockquote>
  <p>console.log('only fires if element already exists');</p>
  </blockquote>
  <p>}</p>
  </blockquote>
  <p>Is there a better way to do this? I would like to avoid including the whole jQuery just for this.</p>