I am new to Angular JS and now i am trying to learn Angular2. Because i heard it is going to be the next big thing. But is Angular2 a client side framework or server side framework ? I know it is written in TypeScript which will be compiled to Javascript. So if i have a normal Java web application, how can i use Angular2 in it ?
-
1. There is not one but many questions here. 2. Have you done any basic research at all before asking here? 3. How you can leverage from a framework is too broad question. Check out AngularJS web page, follow a few tutorials and take it from there. – Tarmo Jan 21 '16 at 17:04
2 Answers
There's no right answer to that, you can do it in many ways. It's a client side framework, although it has a new featured called server side rendering. Who knows if it'll get others similar.
The Easiest way to integrate a Framework like this into your current Java Web Application depends a lot on the current architecture of your application, but the most common way to do it is to create a Rest API out of your current application and have your new Angular Application consume those services and display them.

- 5,326
- 2
- 26
- 42
-
Note that you can use http://lteconsulting.fr/angular2boot/ to directly program Angular 2 in Java 8, without having to write any Javascript line ! – Arnaud Tournier May 14 '16 at 13:29
You build the Angular client and the result is just like static HTML from the server point-of-view. Angular then makes HTTP requests to the server to fetch and update data. Basically the server and client are two separate applications that communicate over the network.
When the Angular client application is served on the same URL and port where the HTTP requests are served, then you don't have to take care for CORS issues.
The server should redirect all requests to index.html
so HTML5 push-state can be used (see for example Angular ui-router pressing refresh causes 404 error).

- 1
- 1

- 623,577
- 216
- 2,003
- 1,567