How to include angular2/4 component in JSP page?

后端 未结 4 1136
孤街浪徒
孤街浪徒 2021-02-10 15:12

I want to add angular component into JSP page, what are the possible ways ?

To Describe more :

I have one application dynamic web application in JSP and another

4条回答
  •  孤城傲影
    2021-02-10 15:20

    One can use ng build -bh from the location of your angular project. For instance, if you have named your project as client (generated using ng new client) it will create a dist folder under the project client.

    Copy the contents from the dist folder to your WebApp in the WebContent folder. Now either use the index.html of your client project or paste it to the index.jsp. Now access the webApp, now angular 2 components will be served.

    Please note that when the build in for non-production, all the node_modules will served from the location of client project, if you want to server everything from the webApp itself then build it for prod mode ng build -bh --prod, all modules will be combined into single file.

提交回复
热议问题