angular-universal

Update meta tags in angular universal with external API call

吃可爱长大的小学妹 提交于 2019-12-04 23:56:51
问题 I've spent more than 2 months but could not found a clear solution of how to proceed with angular universal. I've already spent about 6 months in implementing angular universal on a project for which I don't get a much time and now I'm stuck with this issue. Can anyone help me with this as it seems the whole world want to know a solution for Angular SSR. Here's my code(Meta tag service): import {Injectable} from '@angular/core'; import { Meta, Title } from '@angular/platform-browser'; import

Using cookies in Universal Rendering using angular-cli

荒凉一梦 提交于 2019-12-04 23:45:37
问题 I have made an angular app using angular-cli and doing universal rendering in it by following steps given here . But it is mentioned that i can't use Global variables like window and document in my app if i am doing universal rendering, How can i set cookies at front end to maintain user session. Previously i was using JWT, but for doing that i need to set cookies in my browser. 回答1: Note: all the information below is only valid if you're using Node with Express to dynamically render (at the

How to deploy Angular Universal project to standard hosting?

自闭症网瘾萝莉.ら 提交于 2019-12-04 18:13:12
I have my Angular Universal project working on my localhost. So now I would like to test it on my standard web hosting with Node.js installed. I have run: npm run build and received dist folder with client and server subfolders. How should I use these folders and files into them to run the project on the hosting? Thanks. So I have deployed my Angular Universal project to my hosting. I can say that the support team of my hosting gave me a lot of help. I don't know if is it possible to deploy such project on the own. My hosting has a Node.js support. Support team of the hosting gave me an

How to make Angular Universal and PWA work together?

若如初见. 提交于 2019-12-04 14:38:45
问题 I have a SSR Angular app which I am trying to transform into a PWA. I want it to be server-side rendered for SEO and for the "fast first rendering" that it provides. The PWA mode works fine when combined with SSR, but once the app is loaded, when we refresh it, the client index HTML file is loaded instead of the server-side rendered page. I have dug into the code of ngsw-worker.js and I saw this: // Next, check if this is a navigation request for a route. Detect circular // navigations by

How to add class to <body> in Angular Universal?

时间秒杀一切 提交于 2019-12-04 14:05:29
We can user Rendered2 in browser version of Angular app but it requires document.body reference and it's not available on server rendering. platform-browser has Title and Meta components but I would like to have more control over <head> section, like injecting <script> tags, accessing body element, etc. Is there a way to do it? Maxim Koretskyi Actually, Angular Universal uses DOMINO library under the hood, which creates document in the same way as browser does. The only difference is that you have to inject DOCUMENT like this: import { DOCUMENT } from '@angular/common'; import { Component,

Why postcss-merge-rules vesion give me an error Angular 5 - Webpack

前提是你 提交于 2019-12-04 10:45:31
Error with postcss plugin This a log when I tried a ng build --prod, I' using angular universal only give me that error with bootstrap and font-awesome. 10% building modules 4/6 modules 2 active ...ules/bootstrap/dist/css/bootstrap.cssUnknown error from PostCSS plugin. Your current PostCSS version is 6.0.17, but postcss-merge-rules uses 5.2.18. Perhaps this i 55% building modules 380/383 modules 3 active ...ules/bootstrap/dist/css/bootstrap.cssUnknown error from PostCSS plugin. Your current PostCSS version is 6.0.17, but postcss-merge-rules uses 5.2.18. Perhaps this is the source of the error

How to view the page source for angular 2 app

≯℡__Kan透↙ 提交于 2019-12-04 02:04:14
问题 I have web app, whenever i am view the page source using browser view page source i am only able to see the index.html contents in page source where as i am able to see the all the html code in inspect element but not in page source. Does any one how to view the page source ?? Below is the server.ts 回答1: It is only possible with Angular Universal (server side rendering). Every javascript files renders in browser, to see page source you have to setup Angular 2 to render on server side. It's

error using isBrowser function in angular universal

白昼怎懂夜的黑 提交于 2019-12-03 22:02:35
问题 I'm trying to use the isBrowser function in angular universal but I keep getting the same error when I build. I did install the npm package of angular-universal npm i angular2-universal --save 'ng build -prod -aot' ERROR in Illegal state: symbol without members expected, but got {"filePath":"C:/dir/universal/website/node_modules/@angular/platform-browser/platform-browser.d.ts","name":"__platform_browser_private__","members":["BROWSER_SANITIZATION_PROVIDERS"]}. ERROR in ./src/main.ts Module

Convert Angular 4 web app to Angular Universal app

断了今生、忘了曾经 提交于 2019-12-03 21:51:04
问题 I have a requirement to convert Angular 4 web app to Angular Universal.The reason for that is currently, the web app is not able to be properly indexed by Google (and Facebook social previews thumbnails) because it's a single page app and rendered on the client side.So now I need to implement Angular Universal, server-side rendering. I got the knowledge of how to create a new Angular Universal app using this great video series. Question: Can you please tell me the direction which I have to

window is not defined angular universal third library

╄→尐↘猪︶ㄣ 提交于 2019-12-03 17:34:52
I am working with the library ng2-mqtt and I used it im my component like this: import 'ng2-mqtt/mqttws31.js'; declare var Paho: any; Now I am getting following error: ReferenceError: window is not defined at Object.<anonymous> (/Users/Picchu/Documents/em3/node_modules/ng2-mqtt/mqttws31.js:2143:4) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object.<anonymous> (