I'm following this link to implement localization in Angular using i18n.
When i navigate to "url/en" or "url/fr", instead of pointing to respective directory folders it is trying to search for a route and giving the below error message.
core.js:15723 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'fr'
I have created this Angular 7 project using VS2019. For the backend i'm using asp.net core 2.2 web api.
Running following commands shows the page with the correct translations locally.
ng serve --configuration=fr
My angular.json file as shown below.
My Package.json file as shown below
I have configured route in this way in app.modules.ts
RouterModule.forRoot([ { path:'', component:HomeComponent, canActivate:[AuthGuard] },
I modified the .csproj file in this way.
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build-locale" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build-locale:ssr" Condition=" '$(BuildServerSideRenderer)' == 'true' " />