Deferred compilation of Angular.js templates for applications that render HTML from asynchronous processes.
npm install angulariseAngularise
==========
!Travis
!npm
!License MIT
* Heroku: http://angularise.herokuapp.com/
* Bower: bower install angularise
---
Angularise is a simple module for compiling HTML templates outside of the Angular.js runloop – such as asynchronous AJAX requests – in the case of Angularise you don't even require the scope to compile the HTML.
By default Angularise uses the scope which the ng-app attribute is assigned to – the root scope – you may override this default functionality.
In order to work with the Angularise module you simply need to pass in your HTML to the global angularise() method:
``javascript`
var compiledHtml = angularise('My HTML');
targetNode.append(compiledHtml);
All of this is especially useful when you consider an example with loading the HTML via an AJAX call – naturally you should be using the Angular.js approach of templates, but in legacy systems this is not always possible:
`javascript
$.ajax('inception.html', { complete: function onComplete(response) {
// Compiled the response text and then append it to a node.
targetNode.append(angularise(response.responseText));
}});
`
Instead of using the node with the ng-app attribute, pass in a valid HTML element as the second argument of the angularise() method:
`javascript``
angularise('My HTML', document.querySelector('div'));