angular-universal

Angular 9 - You must pass in a NgModule or NgModuleFactory to be bootstrapped

主宰稳场 提交于 2020-04-18 07:16:09
问题 I updated my Angular app from v6 to v9, and when testing it is really ok, but when I deploy it to my staging server, I have this error: You must pass in a NgModule or NgModuleFactory to be bootstrapped I have searched a lot about it, but I have no idea what could be done here. ./server.ts: const environment = process.env.NODE_ENV || 'local'; const docker = process.env.DOCKER || false; // These are important and needed before anything else import 'zone.js/dist/zone-node'; import 'reflect

Angular 9 - You must pass in a NgModule or NgModuleFactory to be bootstrapped

泄露秘密 提交于 2020-04-18 07:16:01
问题 I updated my Angular app from v6 to v9, and when testing it is really ok, but when I deploy it to my staging server, I have this error: You must pass in a NgModule or NgModuleFactory to be bootstrapped I have searched a lot about it, but I have no idea what could be done here. ./server.ts: const environment = process.env.NODE_ENV || 'local'; const docker = process.env.DOCKER || false; // These are important and needed before anything else import 'zone.js/dist/zone-node'; import 'reflect

angular universal: dynamic imports for browser only

若如初见. 提交于 2020-04-11 03:33:25
问题 Is it possible to import a module based on condition? Specificly import external module only if angular 2 universal app being rendered in browser but not in server. This question is relevant to some PrimeNG modules that depend on browser features and can be rendered only in browser. It would be great to omit them at server rendering cause calendars and other components are not really important for SEO. Currently I can render Calendar component if turn off server rendering. But server produces

angular universal: dynamic imports for browser only

房东的猫 提交于 2020-04-11 03:33:10
问题 Is it possible to import a module based on condition? Specificly import external module only if angular 2 universal app being rendered in browser but not in server. This question is relevant to some PrimeNG modules that depend on browser features and can be rendered only in browser. It would be great to omit them at server rendering cause calendars and other components are not really important for SEO. Currently I can render Calendar component if turn off server rendering. But server produces

SSR with (RE)Hydration in Angular

久未见 提交于 2020-03-23 17:21:11
问题 Angular Universal is for Server side rendering. I have a full functional Angular app. To increase FCP. I need to hydrate with server side rendering. Is Angular universal allows dynamic SSR. Loading certain components in server side ? I couldn't find anything related to that.(Yes I did some google search on it). I have found similar topic here,but i need to know more than that. The dicision boundary between Angular & Angular Universal. Found some articles related here. Does it bypass data to

Angular Universal ReferenceError - KeyboardEvent is not defined

半世苍凉 提交于 2020-01-30 07:42:07
问题 I have added "domino" in the server.ts and even updated webpack.server.config.js as : module: { rules: [ { test: /\.(ts|js)$/, loader: 'regexp-replace-loader', options: { match: { pattern: '\\[(Mouse|Keyboard)Event\\]', flags: 'g' }, replaceWith: '[]', } }, { test: /\.ts$/, loader: 'ts-loader' }, ] } But still getting the same error : "ReferenceError - KeyboardEvent is not defined". I am running these commands in terminal $npm run build:ssr $npm run serve:ssr Commands Defined in package.json

Angular Universal ReferenceError - KeyboardEvent is not defined

喜你入骨 提交于 2020-01-30 07:41:16
问题 I have added "domino" in the server.ts and even updated webpack.server.config.js as : module: { rules: [ { test: /\.(ts|js)$/, loader: 'regexp-replace-loader', options: { match: { pattern: '\\[(Mouse|Keyboard)Event\\]', flags: 'g' }, replaceWith: '[]', } }, { test: /\.ts$/, loader: 'ts-loader' }, ] } But still getting the same error : "ReferenceError - KeyboardEvent is not defined". I am running these commands in terminal $npm run build:ssr $npm run serve:ssr Commands Defined in package.json

Angular Universal ReferenceError - KeyboardEvent is not defined

半城伤御伤魂 提交于 2020-01-30 07:41:07
问题 I have added "domino" in the server.ts and even updated webpack.server.config.js as : module: { rules: [ { test: /\.(ts|js)$/, loader: 'regexp-replace-loader', options: { match: { pattern: '\\[(Mouse|Keyboard)Event\\]', flags: 'g' }, replaceWith: '[]', } }, { test: /\.ts$/, loader: 'ts-loader' }, ] } But still getting the same error : "ReferenceError - KeyboardEvent is not defined". I am running these commands in terminal $npm run build:ssr $npm run serve:ssr Commands Defined in package.json

how does Angular HttpInterceptor get called?

China☆狼群 提交于 2020-01-15 10:11:26
问题 I'm trying to understand some code here: transfer_http.ts I'm trying to understand how it invalidates the cache: // Stop using the cache if there is a mutating call. if (req.method !== 'GET' && req.method !== 'HEAD') { this.isCacheActive = false; this.invalidateCacheEntry(req.url); } How do you get a situation when req.method !== 'GET'? I only use GET requests. 来源: https://stackoverflow.com/questions/55213396/how-does-angular-httpinterceptor-get-called

Angular Universal 5 - Meta Service not working

馋奶兔 提交于 2020-01-06 06:58:23
问题 I had my meta tags working for Facebook and Twitter but I've somehow broken them. I looked at examples, but I can't see the issue. (There are no errors.) The tags just don't change from the defaults in index.html. I'm using Angular Universal 5. Unlike the examples I found, I'm not writing the tags in the constructor. Not sure if that's a factor. I must be missing some rule of using the Meta service. Here's the code... import { Meta } from '@angular/platform-browser'; ... constructor( ...