title: Angular JS - Image Maps and filters
body: <p>I took a bit of a break from learning Angular for a while, and I'm jumping back in and am having something of an issue controlling an image map.</p>
  
  <p>Basically, I've got a map with a bunch of weirdly shaped areas, and I want the mouse rollover to control a filter in an earlier ngRepeat - I know that I can set ng-mouseEnter on standard divs to change the value of a model and update my data in real time, but I have no idea how to get that working inside a map as ng-mouseEnter won't work with standard image maps.</p>
  
  <p>My thought was, I set a really simple inline script function like this:</p>
  
  <pre><code>function showThis(thing) {
      return thing;
  }
  </code></pre>
  
  <p>and have my onMouseEnter part of the image map update that function, then reference that in my filter.  A quick example of what I was thinking of in code (with one of my image map areas copy-pasted, to show that it would be kind of difficult to just make invisible divs) - </p>
  
  <pre><code>...
  &lt;script&gt;
  function showThis(thing) {
      console.log(thing);
      return thing;
  };
  &lt;/script&gt;
  
  &lt;div class="foobars" ng-repeat="foo in fooBar | filter:showThis():true"&gt;
      &lt;p class="foo_text"&gt;{{foo.snippet}}&lt;/p&gt;
      &lt;img ng-src="{{foo.imagePath}}"&gt;
  &lt;/div&gt;
  
  &lt;div class="images"&gt;            
      &lt;img src="images/map/base.png" usemap="#imagemap"&gt;
          &lt;map name='imagemap'&gt; 
              &lt;area shape='poly' alt='Area One' href='' coords='33,288,35,276,41,272,60,276,96,234,97,198,140,171,189,192,182,242,144,261,144,271,108,286,66,297,42,296' onMouseEnter='showThis(1)'/&gt; 
              &lt;area shape='poly' alt='Area Two' href='' coords='245,170,186,194,144,176,149,136,212,110,252,123'  onMouseEnter='showThis(2)' /&gt; 
          &lt;/map&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But that doesn't work, and I can't work out how to get the idea running.  I'm clearly missing something obvious, but I don't know what - I know I could create a custom filter in the controller, but I still don't know how to associate the image map's "onMouseOver" with the filters inside the controller.  Angular and this particular feature of imagemaps don't seem to work too well together to my lame eyes.</p>
  
  <p><a href="http://plnkr.co/edit/B5cP7jVC9optBJRoGxTA?p=preview" rel="nofollow">I made a plunkr here</a> to show my broken-ass code.  Where am I going wrong?</p>