angular-universal

Angular6 universal giving continues Error on console

六月ゝ 毕业季﹏ 提交于 2019-12-10 21:07:31
问题 I am using angular 6 and implemented the angular universal for server side page rendering, Everything works fine but I am getting continues error in my console. ERROR [Error] ERROR [Error] And I have declared window as global variable still I am getting errors like this Unhandled Promise rejection: window.some_function is not a function my server.ts file // import 'zone.js/dist/zone-node'; import 'reflect-metadata'; import { enableProdMode } from '@angular/core'; import * as express from

Angular CLI 6 - ng build doesn't produce Server bundles

非 Y 不嫁゛ 提交于 2019-12-10 20:10:05
问题 I am following the official Angular Universal guide available at https://angular.io/guide/universal but when I run ng build --prod it does produce client bundles but doesn't produce server bundles. Since my environment is ASP.Net Core, I have skipped Universal Webpack configuration and server.ts . With previous version of Angular CLI we were able to build server bundle by specifying app while building ng build --app=ssr Am I missing something? Can anyone please help? 回答1: Fix: One thing

Error: No NgModule metadata found for '[object Object]'

风格不统一 提交于 2019-12-10 18:14:53
问题 I am attempting to convert my angular 6 application to server side rendering (for SEO purposes), and everything seems to compile without error. Except when I actually navigate to the to localhost, I and getting the full error of Error: No NgModule metadata found for '[object Object]'. at NgModuleResolver.resolve (/execroot/angular/packages/compiler/src/ng_module_resolver.ts:31:15) at CompileMetadataResolver.getNgModuleMetadata (/execroot/angular/packages/compiler/src/metadata_resolver.ts:509

Angular 5 Universal (SSR) with dotnet core not working with i18n angular tools on Staging server

耗尽温柔 提交于 2019-12-10 16:06:01
问题 I'm trying to make the Angular Project Template with dotnet core running with the I18n Angular tool. (https://docs.microsoft.com/en-us/aspnet/core/spa/angular?tabs=visual-studio) Here is what I have in my startup class app.Map("/fr", fr => { fr.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; spa.UseSpaPrerendering(options => { options.BootModulePath = $"{spa

Angular SSR 'Failed to lookup view' on production (Ubuntu, Nginx)

你离开我真会死。 提交于 2019-12-10 15:09:49
问题 Following up the official Angular tutorial on setting up SSR using Express server: https://angular.io/guide/universal#configure-for-universal The tutorial would setup paths like this: ... const DIST_FOLDER = join(process.cwd(), 'dist'); ... app.set('views', join(DIST_FOLDER, 'browser')); This works pretty well on the local server. However once deployed at the server (powered by Nginx), getting the error: Error: Failed to lookup view "index" in views directory "/home/user_name/dist/browser" at

Angular 6 Server Side Errror: Module not found: Error: Can't resolve './dist/server/main.bundle'

僤鯓⒐⒋嵵緔 提交于 2019-12-10 12:43:09
问题 I'm working on a project, updating it to Angular 6. After the update, I'm now getting this error when trying to run the server-side rendering build Module not found: Error: Can't resolve './dist/server/main.bundle' I tried going to https://angular.io/guide/universal and matching up my code to the SSR files in Angular Universal. This did not work for me. It seems that the dist folder is not generating a /server folder but is creating a /browser. Im unsure why. Here's my angular.json file { "

How implement SEO (Metatags) in Angular 2 (with Angular universal for rendering on server side)?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 03:52:11
问题 I'm searching a fully working example about SEO or Metatags with Angular 2 using Angular universal to render on server side (to be recognize by facebook, twiter, and other metatags) but I had not success.. I found multiple articles, but there are incomplete (no all source code is available) or oldest (not compile with the latest versions): a) blog.devcross.net/2016/04/17/angular-2-universal-seo-friendly-website/ NOTE: Excelent post with source code, but It's not working. b) builtvisible.com

Angular universal rendering for some routes only

微笑、不失礼 提交于 2019-12-09 06:05:51
问题 I was playing with angular universal a bit but cant find option to use server side rendering only for some pages like home page and render all other routes in standard angular way. I don't want to use server side rendering for private pages where SEO is not needed. I can configure routes in express like this // send all requests to Angular Universal // if you want Express to handle certain routes (ex. for an API) make sure you adjust this app.get('/', ngApp); app.get('/home', ngApp); app.get(

Angular Universal (ssr) not working for Firestore and Geofirestore

无人久伴 提交于 2019-12-09 03:27:05
问题 Issue : Angular Universal (ssr) not work for pages that use Firebase Firestore database. Tech : Angular version 7, Angular Cli, Angular Universal, Firebase hosting, Firebase Functions, Firebase Firestore database. My server side rendering works fine on all pages. Issue is when I view this page: [https://behired-staging.firebaseapp.com/job-board][1] it doesnt show the data. The data doesnt take too long to load either. I see the html, but not the ul li for the list of 20 jobs on display.

How to get full url in Angular?

瘦欲@ 提交于 2019-12-08 19:22:39
My app takes advantage of Angular Universal and I'd like to get the full path of the current url in an Angular component. I think I have to use the window object where I may need to inject the window or maybe the better option is to simply check if it's in the browser. Are there any cleaner solutions utilizing Angular's API? url: string; constructor(private router: Router) { } ngOnInit() { this.router.events.subscribe((val) => { this.url = `${window.location.protocol}//${window.location.host}${window.location.pathname}`; }); } Edit: The question I'm asking is how to get the full url in a way