Hot answers tagged tags
It is: wp.template( templateName ) I can't find it in Codex and could not explain it better, so here's a link.
You're close. Your first attempt is using get_the_tags incorrectly. The function accepts the post ID you want to get the tags from. In your example, there is no $tag global, so $tag->name is trying to fetch a property of a non-object. In your second attempt, a single post won't have any tag-related query vars, that would only be set on a tag archive page ...
Only top voted, non community-wiki answers of a minimum length are eligible