Springmvc Simple Integration Angular2

This article describes the example of SpringMVC simple integration Angular2, shared to everyone, specifically as follows:

Angular uses an example


Copy all files into the SpringMVC project, the file path may occur during copying, then compress the entire file, then copy the compressed file, then decompress it. The directory structure is as follows, I am copy to the Angular directory

SpringMVC简单整合Angular2的示例 Spring configuration file setting path

SpringMVC简单整合Angular2的示例 Then in the HTML page, as shown in Angular official, introduce file

SpringMVC简单整合Angular2的示例 This requires the path to these files

Mainly in the systemjs.config file, you need to modify two places

Such a project can run

, but this can be operated because we TypeScript has been compiled into a JS file, we can’t modify the TS file each time, then compile, then run the project, so we need to automatically compile TypeScript for JavaScript SpringMVC简单整合Angular2的示例
Since I use the IDEA editor, there is self conversion editing tool belt, it requires only a simple configuration can (provided that the machine is installed nodejs Typescript and dependent)

File- “Settings-” Languages ​​& Frameworks- “node.js and NPM selected native Node.js


FILE- “Settings-” TypeScript [1

TypeScript version is best to choose the NPM TypeScript dependence downloaded by this machine, select the lib folder SpringMVC简单整合Angular2的示例
-P Web \ Web-inf \ angular this command is a directory representing compiled. If there is no, search the project root path, because we put it in the Angular directory, you need to set

It can be compiled in the editor, but it will not do automatic compilation

We hot deployed to Tomcat steps, usually make Make, then package, then start the project, do automatic compilation, only need Before Make, you can compile TypeScript

The above is all the contents of this article, I hope that everyone’s learning is helpful, I hope everyone supports TUMI clouds. .


© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment