$ionicGesture Element


I am trying to implement at swipe gesture to change views, however I keep getting this error:

I have been trying to get the code below to work, however I am not sure what the elem is. I see in the docs that it says it is the Angular element to listen for the event on, however in all the examples I have seen, I only see elem, or $element, nothing specific. I have tried both of those and still get the errors above.

The code below is from this codepen: http://codepen.io/calendee/pen/jLswe

    .directive('dragBack', function($ionicGesture, $state) {
       return {
           restrict : 'A',
           link : function(scope, elem, attr) {
              $ionicGesture.on('swipe', function(event) {
                 console.log('Got swiped!');
              }, elem);

Any help would be great, thanks!