I'm new Angular2 and learning it using TypeScript. I understood that everything is component in Angular2 and we do not render whole HTML page but by just specific component. I have 2 basic queries here:-
1) In my sample, Angular 2 app, I have service component class which brings static data to my component class using Dependency Injection. Instead of static, I want to bring data from my database (MongoDB). Between service layer and database, I'm quite confused. May I know what are industry best approaches to integrate service layer and database layer in a regular Angular 2 app? Do we have tightly coupled architecture like normal JAVAJ2EE MVC architecture from controller to service to dao to hibernate/JDBC/ibatis or do we integrate using web services (RESTful APIs'), loose-coupled fashion?
2) Secondly, how do we package this Angular 2 web app? Do we simply zip it or export as WAR file? Currently, I'm running it on my local system using my Node.js (npm start, etc on command prompt) and using Visual Studio Code for coding? How to create WAR file and does Tomcat App server supports Angular 2 apps?
1) After moving of from Angular 1, I've been looking into React/Redux, and so am unfamiliar with Angular 2 at this point. (That will likely change in the future, but of now...) That said, most component architectures (including React/Redux) do not recommend mixing presentation components (those that represent visual elements) with backend data details. In React/Redux, one currently popular approach is to create non-presentational "container" components that take care of data details as managed by the Redux store.
I would suggest searching for articles on the same subject for Angular 2 to see what patterns and approaches are being widely used in that arena.
2) Why would you need to serve a client-only web application from a JEE server? As there is no backend, you can serve it from any simple web server.