angular-universal

AngularUniversal prerendering error: UnhandledPromiseRejectionWarning: Error: No NgModule metadata found for 'class{}'

天涯浪子 提交于 2021-01-29 08:33:21
问题 Goal Question looks long winded - it's not! I'm using Angular Universal to implement SSR, following this tutorial. Universal/express-engine is installed, main.js is generated in the dist/projectname/server folder, and I've created a prerender.js folder in the project root. Problem When I try npm run prerender it starts work prerendering until eventually hitting the following error: Prerendering 5 route(s) to C:\Users\odubh\Documents\Personal_Web_Projects\Hibernio.com\Hibernio0.3\hibernio\dist

Angular SSR Refresh/Load Page Pending Api Call

淺唱寂寞╮ 提交于 2021-01-29 04:59:13
问题 I am using an Angular 9 .net core spa app. On pages with api call the app becomes stuck (pending on the Network tab in Chrome) and comes back with (failed) net:ERR_EMPTY_RESPONSE The home page works fine and uses an api on the ng-init event and other pages without an api call work fine and I can jump between these pages back and forth without an issue. It just other pages that that depend on an api call give the problem. The web.config is empty as I just build within VS 2019 and publish.

Using angular 7 universal with Openlayers 5

蹲街弑〆低调 提交于 2021-01-28 13:48:06
问题 I've got an angular 7.2 app using open layers 5.3. I'm trying to set up angular universal for this app, but when I run the universal server ( node dist/server.js ), I got some errors due to client only variables not being defined, such as window . webpack:///./node_modules/ol/has.js?:54 var DEVICE_PIXEL_RATIO = window.devicePixelRatio || 1; ^ ReferenceError: window is not defined I tried using domino to mock these variables, but it just fails with another error, because of a canvas element

reinstall angular universal after angular cli upgrade

99封情书 提交于 2021-01-27 22:48:30
问题 I upgraded my angular cli from the 6 version to the 8.1, Angular universal has changed the simple construction method by @nguniversal/module-map-ngfactory-loader , I should re-deploy, clear the old configuration. run ng add @nguniversal/express-engine --clientProject [project name] Error message: Skipping installation: Package already installed Target name already exists. run npm install --save @nguniversal/module-map-ngfactory-loader build universal, run build:ssr ("npm run build:client-and

reinstall angular universal after angular cli upgrade

只愿长相守 提交于 2021-01-27 21:13:42
问题 I upgraded my angular cli from the 6 version to the 8.1, Angular universal has changed the simple construction method by @nguniversal/module-map-ngfactory-loader , I should re-deploy, clear the old configuration. run ng add @nguniversal/express-engine --clientProject [project name] Error message: Skipping installation: Package already installed Target name already exists. run npm install --save @nguniversal/module-map-ngfactory-loader build universal, run build:ssr ("npm run build:client-and

Angular 7 Universal, ReferenceError: window is not defined

坚强是说给别人听的谎言 提交于 2021-01-27 20:02:55
问题 I'm making a SSR with Angular 7 and Angular Universal, but when I use Fusioncharts from third parties I've got this errors when i run this script npm run build:ssr && npm run serve:ssr ReferenceError: window is not defined at Object.undefined.module.exports.module.exports (C:\Users\ridho.fauzan\Documents\angular-app\bizhare-frontend\desktop\dist\server.js:161938:807) I've tried to use domino on the server.ts files but it still not working this is my server.ts file import 'zone.js/dist/zone

Angular universal - Server side requests cached for client

不想你离开。 提交于 2021-01-27 05:53:55
问题 I've seen many articles about caching data for client in angular universal apps, so it doesn't duplicate the requests on client that has been already resolved on server. I just don't get how the data is transferred from server to the client. Do I inject the JSON to pre-rendered HTML or am I missing something else ? 回答1: As of angular 5, there is a module inside angular core called TransferStateModule that does this for you. https://angular.io/api/platform-browser/TransferState You simply add

Angular universal - Server side requests cached for client

半腔热情 提交于 2021-01-27 05:53:42
问题 I've seen many articles about caching data for client in angular universal apps, so it doesn't duplicate the requests on client that has been already resolved on server. I just don't get how the data is transferred from server to the client. Do I inject the JSON to pre-rendered HTML or am I missing something else ? 回答1: As of angular 5, there is a module inside angular core called TransferStateModule that does this for you. https://angular.io/api/platform-browser/TransferState You simply add

npm run build:ssr does not work in angular 8

跟風遠走 提交于 2021-01-21 07:09:07
问题 I use angular 8 and server-side-rendering but i got error when i run npm run build:ssr As you can see, src is repeated twice home/app/front/**src/src**/main.server.ts I tried everything without success. I move main.server.ts and i created a new src but no succes. angular.json { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "front-end": { "root": "", "sourceRoot": "src", "projectType": "application", "prefix": "app",

Angular 6: Download file after getting File object from backend server

喜你入骨 提交于 2021-01-03 16:11:52
问题 I have a File object type of structure {type: "Buffer", data: Array(702549)}, what do I need to do in angular 6 in order to download this file in browser? I get my response from this function: getMarketingProposalById(id: string): Observable<MarketingProposal> { return this.httpClient.get<MarketingProposal>(this.apiUrl + id , this.httpOptions).pipe(map(marketingProposal => { if (marketingProposal.materials[0] && marketingProposal.materials[0].file) { const blob = new Blob([marketingProposal