In the new Angular 2, we have Components. Can this be compared to Portlets? Even though this is not independently deploy-able. What are the pros and cons of these two approaches?
This is like comparing apples with oranges. Angular2 components are meant for developing SPA applications (single page applications). These are javascript, front-end only applications that need full ownership of the browser's page.
Java portlets (I guess you mean Liferay or JSR 268 portlets) on the other side are both front-end and back-end applications that do not own the page. They live inside a container that orchestrates things and share the page with other portlets. Main goal of the portlet is to be able to work in different scenarios and co-operate with other components.
It is indeed technically possible to use Angular2 for the front-end part of a portlet. However, I wouldn't recommended this, as you would need to deviate a lot of standard Angular and Portlet practices and probably compromise the re-usability of the portlet.
For the above reasons, it is impossible to directly compare these two technologies, as they aim to cover different needs. If your goal is to use a modern javascript framework for the front-end part of your portlets, I would suggest to look instead at javascript libraries, like Backbone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With