cupmanager / jangular

Java Templating engine with AngularJS-like syntax
MIT License
1 stars 0 forks source link

the library looks bright but why no use same syntaxe as Angular ? #1

Open patou opened 9 years ago

patou commented 9 years ago

Your library can be used to create html version of an angular application with the use of the same template in the front and the back ! Why you don't use the same template syntaxe ? like {{var}} and ng-repeat We can create some directive or keep the directive to the angular js (like ng-click). It can allow us to use the same file for the angular and the html version in the serveur (for search engine indexer) or to pre build a page.

maxmart commented 9 years ago

Hi! At first we did try to have the same syntax as AngularJS for {{variables}}. But we soon changed it because if we use the same syntax, we can't use both jangular and angularjs at the same time, since jangular would try to evaluate all {{...}} before it can even reach the web browser and angularjs running there.

For our primary use-case we want to be able to use jangular to produce HTML on the server-side, and then use regular angularjs on the client side for certain smaller dynamic parts of the site. And then having {{...}} and ng-repeat would conflict.

patou commented 9 years ago

Maybe have a config to switch between two syntaxe ?

My use case was to have html template shared between server and client.

maxmart commented 9 years ago

Yes, that would be great. Unfortunately, at the moment I think it is pretty hardcoded in the CompilerMarkupHandler class. We don't have time to fix anything right now (too busy with work), but if you want to submit a pull request for it, then I would gladly accept it :-)

But I would probably recommend that you try to test the library as it is first, to see if it's usable enough for you. As the README says, it's "Really super-early experimental alpha" :-)

Regards, Max