Message Boards

Angular 8 Portlet using the CLI and Liferay AMD Loader

Alex Clark, modified 4 Years ago.

Angular 8 Portlet using the CLI and Liferay AMD Loader

New Member Post: 1 Join Date: 8/1/17 Recent Posts
I was wondering if there was a way to create an Angular 8 portlet using the Angular CLI and Liferay AMD Loader. I know Liferay has an example Angular portlet, but that is on Angular 5 plus all the Angular components are all individual files wrapped in the Liferay AMD Loader. I was hoping to be able to take advantage of the Angular CLI and the bundled files for vendors, polyfills, etc. But the files the CLI builds, if I wrap them in the Liferay AMD Loader using Liferay's npm bundler, don't work. It can't find the methods I am looking for to bootstrap angular. 

My approach right now is to build the Angular app using the CLI, copy over the dist folder from the Angular application to the Portlet's build directory. And then include the index.html from the Angular app in the view.jsp. This works fine for having one portlet per page. But if I want to include multiple like the BLADE sample, I need to bootstrap each Angular app using the portlet namespace and the Liferay AMD Loader. Any help would be appreciated. Thanks.