我有一个角度应用程序,可以很好地在本地服务。
这是package.json
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:prod": "ng build --prod --base-href=/widcp/",
},
并且在网络的pom.xml中,我有这个
<build>
<finalName>widcp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
<webModule>
<groupId>com.td.phone</groupId>
<artifactId>td-widcp-web</artifactId>
<uri>td-widcp-web.war</uri>
<bundleFileName>td-widcp-web.war</bundleFileName>
<contextRoot>/widcp</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
[当我在本地运行jboss并导航到http://localhost:8080/widcp
角度应用程序引导程序并正确加载时,所有js文件和css文件都已下载,并且看到app.component已加载。
问题是当我去某条路线时,JBOSS认为我正在请求文件或文档,并且将返回未找到
最后我最终得到了usingHash
,如下所示
app-routing.module.ts
imports: [RouterModule.forRoot(routes, { useHash: true })],
并且开始工作