在JBOSS 7结果中访问角形路径404未找到

问题描述 投票:0回答:1

我有一个角度应用程序,可以很好地在本地服务。

这是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已加载。

enter image description here

问题是当我去某条路线时,JBOSS认为我正在请求文件或文档,并且将返回未找到

enter image description here

enter image description here

angular jboss jboss7.x
1个回答
0
投票

最后我最终得到了usingHash,如下所示

app-routing.module.ts

imports: [RouterModule.forRoot(routes, { useHash: true })],

并且开始工作

© www.soinside.com 2019 - 2024. All rights reserved.