Enlive and AngularJS Issues

209 views
Skip to first unread message

James Thornton

unread,
Aug 13, 2012, 6:45:59 AM8/13/12
to ang...@googlegroups.com
Enlive (https://github.com/cgrand/enlive/) is one of Clojure's most popular templating systems. It uses TagSoup under the hood, but there are a few minor things you have to do to make it work with AngularJS. 

Here's how you normally start an AngularJS document:

<!doctype html>
<html ng-app>

However, TagSoup only recognizes uppercase DOCTYPE so if you enter it as lowercase, Enlive won't include the doctype in the generated document.

TagSoup also rewrites the above HTML tag as...

<html ng-app="ng-app">  

...but this causes JavaScript errors...

Uncaught Error: No module: ng-app angular-1.0.1.min.js:17

You can get around this by setting ng-app to an empty string:

<!DOCTYPE html> 
<html ng-app=""> 

- James

Andy Joslin

unread,
Aug 13, 2012, 7:12:46 AM8/13/12
to ang...@googlegroups.com
Hi James,

Remember that ng-app is just a shortcut.  You can also just put in your Javascript:
angular.bootstrap(documentOrAnyHtmlElement, ['myApp']);

Andy Joslin

unread,
Aug 13, 2012, 7:13:02 AM8/13/12
to ang...@googlegroups.com

James Thornton

unread,
Aug 15, 2012, 11:15:55 AM8/15/12
to ang...@googlegroups.com
Thanks Andy.

On Monday, August 13, 2012 6:13:02 AM UTC-5, Andy Joslin wrote:
http://docs.angularjs.org/api/angular.bootstrap
Reply all
Reply to author
Forward
0 new messages