Angular 如何导航到prod build index.html页面中的组件?
我已经创建了以下路由Angular 如何导航到prod build index.html页面中的组件?,angular,routing,angular-ui-router,url-routing,Angular,Routing,Angular Ui Router,Url Routing,我已经创建了以下路由 export const routes: Routes = [ { path: "", component: SigninComponent }, { path: "signin", component: SigninComponent }, { path: "home", component: HomeComponent } ]; 通过如下输入url,我可以成功路由到本地主机中的Home或signin组件 http://localh
export const routes: Routes = [
{ path: "", component: SigninComponent },
{ path: "signin", component: SigninComponent },
{ path: "home", component: HomeComponent }
];
通过如下输入url,我可以成功路由到本地主机中的Home或signin组件
http://localhost:4200/signin
http://localhost:4200/home
为了进行测试,我创建了一个prod构建(npm run build:prod)
如果我打开index.html,“signin”组件正在成功加载
现在我的问题是如何通过物理调用url导航到主组件?
范例
file://infra.corp.local/dfsshares/home/Documents/MyDashboard-Registraion/public/0.1.0/home
错误:找不到错误文件
请建议..在angular build之后,生成静态文件,您需要将它们放入服务器中以便进行路由。如apache、ngix等。您的具体要求是什么,您是否只想查看构建项目?我的要求是通过输入url重定向到主组件,如下所示file://infra.corp.local/dfsshares/home/Documents/MyDashboard-Registraion/home.htmlThis 没有服务器是不可能的。要了解更多细节,您需要某种服务器将所需的路由重定向到index.html。在解析文件://路由时,您请求的任何内容都被视为请求文件。您是否尝试过vs code extension
Live Server
?
file://infra.corp.local/dfsshares/home/Documents/MyDashboard-Registraion/public/0.1.0/home