【发布时间】:2017-07-19 03:09:07
【问题描述】:
我希望将 Angular 2 项目中的 index.html 作为 Spring MVC 应用程序的欢迎页面运行。
我运行 angular 2 的方式是通过npm start。如果我加载 index.html 而不执行 npm start,组件将无法正确加载。
如何将 index.html 作为 Spring MVC 项目的欢迎页面?
编辑:添加了更多细节。
angular-seed 项目按原样加载。我只是想从 angular-seed 项目中加载 index.html 。已经添加了节点模块,它可以完美地与npm start 一起运行。
至于我的 web.xml,我有这样的欢迎文件:
<welcome-file-list>
<welcome-file>AngularContent/src/index.html</welcome-file>
</welcome-file-list>
并且 index.html 有以下内容:
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->
<script src="AngularContent/node_modules/core-js/client/shim.min.js"></script>
<script src="AngularContent/node_modules/zone.js/dist/zone.js"></script>
<script src="AngularContent/node_modules/systemjs/dist/system.src.js"></script>
<script src="AngularContent/src/systemjs.config.js"></script>
<script>
System.import('AngularContent/src/main.js').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
【问题讨论】:
-
你需要正确配置你的src,贴一些代码很有帮助
-
@Jaiwo99 添加了代码。如果您需要更多信息,请告诉我
标签: java angularjs spring spring-mvc web