allenhwkim / angular-template

NodeJS AngularJS Server-Side Template Engine
34 stars 10 forks source link

dynamic ng-include #2

Closed FDIM closed 8 years ago

FDIM commented 8 years ago

I've run into a missing feature and implemented it :)

Documentation states to use ng-include="'path'", but fails with a syntax error. I've corrected this behavior and added variable resolution if single quotes are missing.

Now below will work correctly:

assert(ht("<div ht-include=\"item.template\"></div>", {item:{template:'file2.html'}}).match(/<div>.*file2.html<\/div>/));

Thanks for making this type of template, I can't stand to look at jade... With this I can reuse same htlm for generating page in the backend and in the editor in the frontend!