Skip to content

Instantly share code, notes, and snippets.

@borisd
Created October 24, 2013 11:42
Show Gist options
  • Save borisd/7135764 to your computer and use it in GitHub Desktop.
Save borisd/7135764 to your computer and use it in GitHub Desktop.
<label for='field' tooltip='hello world'>Bla bla</label>
Becomes:
<span class='tooltip'>
<label for='field' tooltip='hello world'>Bla bla</label>
<div class='something'>hello world</div>
</span>
@asafdav
Copy link

asafdav commented Oct 24, 2013

something like this :
Haven't tested it...

directive('tooltip', function () {
  return {
    restrict: 'A',
    replace: true,
    transclude: true,
    scope: {
      tooltip: '@'
    },
    template: 
    "<span class='tooltip'>" +
    "<div ng-transclude></div>" +
    "<div class='something'>{{tooltip}}</div>" +
    "</span>"

  };
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment