-1

When ever I run npm start command my angular works fine as expected.

But when I tried to build it in "prod" mode my application is doing nothing. It just displays static page.

All navigation links are stopped working

package.json

{
  "name": "srm-roster",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxyconfig.json --port 5555",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.0.0",
    "@angular/cdk": "~7.0.3",
    "@angular/common": "~7.0.0",
    -- so on --
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.10.0",
    "@angular/cli": "~7.0.3",
    "@angular/compiler-cli": "~7.0.0",
    "@angular/language-service": "~7.0.0",
    "@types/node": "~8.9.4",
    -- so on --
  }
}

This is how my app-routing.module.ts looks like

const routes: Routes = [
  {
    path: 'dashboard',
    component: DashboardComponent
  }, {
    path: 'rostertable',
    component: RostertableComponent
  }, {
    path: '**',
    redirectTo : 'dashboard'
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Rajath
  • 1,916
  • 6
  • 22
  • 40

1 Answers1

1

Finally I found the solution.

I just moved my dist/project_name folder inside Xampp/htdocs and it started working.

I found answer to my question in this link

Rajath
  • 1,916
  • 6
  • 22
  • 40