Last active
April 12, 2016 19:18
-
-
Save pcote/0c6392e9f3bf2272735cc5563d522176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var googleDirective = function(){ | |
| var d = {}; | |
| d.restrict = "E"; | |
| d.link = function(scope, elem, attrs){ | |
| var textBody = elem.html(); | |
| var url = "http://www.google.com/search?q=" + escape(textBody) | |
| var searchTag = "<a href='" + url + "'>" + textBody + "</a>"; | |
| elem.html(searchTag) | |
| }; | |
| return d; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment