Thymeleaf or AngularJS?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Thymeleaf or AngularJS?

Eslaron
I learning Spring on a project which uses thymeleaf. But I also want to use AngularJS. Does thymeleaf duplicate Angular's functionality and vice versa? I don't want to add unnecessary layers to the app.

Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf or AngularJS?

Zemi
Administrator
Hello,

in a Java application you almost always use a server-side view technology. It could be Thymeleaf or, for example, JSP, JSF or Freemarker. The only way to go without a view technology is to write plain old Java servlets.

AngularJS, on the other hand, is a Javascript framework that executes on the client side. So, if you want to use AngularJS you still need a view technology, although you'll write less template code and more AngularJS code.

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf or AngularJS?

Eslaron
Thanks for the reply ^^ Now it's more clear for me.
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf or AngularJS?

Manas
In reply to this post by Zemi
Thank you for valuable information.

Correct my below understanding.

As per your explainaition the application architecture would be like

  TheamLeaf --> java class --> DB connection

  Theamleaf for design and template.
  Java class for business logic like DB call, external API call etc.
 

And below is my understanding for other approach

  AngulaJs (html,css,Js) -- ajax call --> Backend RestAPI calling


Question: In this scenario there is no require of template file. Also what is different between server side view and client side view , However entier HTML,css is rendering on client side only.





I have one more doubt like...For an application development there is not necessary for to take template file.
Its an extra burden to maintain.
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf or AngularJS?

Reiju
You can create thymeleaf fragments and return them as ajax-response (NOT whole template/page) :)
As for me, thymeleaf really much more user-friendly, especially when you are not frontend developer and modern js-frameworks annoy you.