angular / universal-starter

Angular Universal starter kit by @AngularClass
2.02k stars 688 forks source link

Angular Universal Starter for Angular 5 not working #632

Open renilbabu03 opened 6 years ago

renilbabu03 commented 6 years ago

I have cloned from the angular 5 branch and have implemented the same in my project using cli. I have copy pasted everything that the starter does and have done

npm run build:dynamic && npm run serve:dynamic

Though the process gets completed without error but the universal is only working for static pages like home page, contact page . Pages having data fetched from the server is not working and the view source is not showing the data with html. Its showing the below image

issue

I have been into this for weeks. Not getting much results regarding the issue. Please look into it

MarkPieszak commented 6 years ago

Oh the Angular 5 branch is extremely old (and was just when we were trying to make the huge shift from 4->5). Can you try the latest branch, you should be able to use basically everything in there for 5.0 that you could for 6.x.

Hope that helps!

renilbabu03 commented 6 years ago

@MarkPieszak Thanks for the reply. I have only one problem left. Since I am using angular 5 in my project , it has angular.cli.json file while the angular 6 starter has angular.json file. And both the file structure is different. How can i use the configuration of angular.json in angular.cli.json. Can you please help.!

As i saw in the universal wiki stories, where will this code go in my .angular-cli.json

"architect": {
  "build": { ... }
  "server": {
    "builder": "@angular-devkit/build-angular:server",
    "options": {
      "outputPath": "dist/your-project-name-server",
      "main": "src/main.server.ts",
      "tsConfig": "src/tsconfig.server.json"
    }
  }
}
renilbabu03 commented 6 years ago

@MarkPieszak . I have updated my angular 5 project to anguar 6 and have followed the wiki stories. Code is compiling correctly with not problem but the view source is still not showing the required content. It is showing the same image ng6