Skip to content

Instantly share code, notes, and snippets.

@karlwestin
Last active August 29, 2015 14:04
Show Gist options
  • Save karlwestin/51ea39c88d48da6c5500 to your computer and use it in GitHub Desktop.
Save karlwestin/51ea39c88d48da6c5500 to your computer and use it in GitHub Desktop.
how to use the angular compiler to compile a template outside of an angular app
var app = angular.bootstrap(document.createElement("div"), ["my-module", "ng"])
var $compile = app.get("$compile")
var compiled = $compile(myTmplString);
/*
compiled is a function, publicLinkFn, that is 2 steps away from seeing how any nodes look
nodes are accessed in a childNodes list, that can only be accessed by the compositeLinkFn
there's no access to a tree of the parsed template on the publicLinkFn
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment