angular-universal

How to add the express application generated by Angular Universal in an existing node project

孤街浪徒 提交于 2019-12-11 06:56:18
问题 My situation is as follows: I have a node server with express that serves me on the one hand several angular applications and on the other hand responds to requests from the api. Each of them is configured for a route and finally everything is listening from a single port. Now I am preparing a new angular application with Angular Universal. Following the steps of the official angular guide to implement Universal with express, genre a server.ts file. This file will be responsible for rendering

Angular with universal does not work

独自空忆成欢 提交于 2019-12-11 06:44:15
问题 Hi I am using angular 2 with universal. I am trying to this. First I create a new project : ng new universaldemo. I installed these packages : npm install --save @angular/platform-server @nguniversal/module-map-ngfactory-loader ts-loader @nguniversal/express-engine . Here is my app.module.ts : import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports:

Check width of component rendered by Angular Universal

柔情痞子 提交于 2019-12-11 06:17:57
问题 I have a (carousel) component that needs to check the width of an element. In the browser: I'm able to call ngAfterViewInit and get the width from the @ViewChild handle. But when it's rendered by Universal its width is 0 . This is because the universal-generated dom is still displayed but the browser-generated dom (where my handle is pointing to) is either inside a document fragment or just not displayed. ngAfterContentChecked and ngAfterViewChecked can solve the issue, but i don't want it to

Angular5 Universal lazy loading on firebase hosting and seo

倾然丶 夕夏残阳落幕 提交于 2019-12-11 06:04:28
问题 Does anyone know howto get lazyloading on firebase hosting working? It all works but when I view the source code of my site, I only see the router-outlet and not the text and so on. I've added the code below to my index.js inside the functions folder: extraProviders: [ provideModuleMap(LAZY_MODULE_MAP) ] My app.server.module file looks like this: import { NgModule } from '@angular/core'; import { ServerModule } from '@angular/platform-server'; import { AppModule } from './app.module'; import

Is there a way to send data from client to server in angular universal?

余生颓废 提交于 2019-12-11 05:28:44
问题 We are using angular 5.2.8 with nguniversal/express-engine 5.0.0-beta.6 and we are using external payment services. The payment system requires a form to be posted to their URL and has an input for callbackURL. The callback from that request sends us back a POST request with data. We need to post that data to our backend with user credentials. In angular we can't receive post requests. I have tried some options for the solution but none of them worked so far: Listening for posts in express

Angular Meta Service not adding and updating dynamic tag values

不想你离开。 提交于 2019-12-11 04:21:01
问题 I'm working on SeoService for my Angular 6 project https://mypleaks.com. I'm trying to add and update Meta tag as my content URL changes dynamically. I'm able to console.log('18 ' + title); console.log('19 ' + description); but when I'm appending title and description in addTag and updateTag tag only static value('myPleaks | ') getting appended, and can be seen on inspecting page sources on this link https://mypleaks.com/#/content/16/Manikarnika-Teaser-Launch-Kangana-Ranaut-Celebrates-with

DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), … methods instead

狂风中的少年 提交于 2019-12-11 03:26:47
问题 I have an angular project and recently I have added angular-universal to it using the following command: ng add @nguniversal/express-engine --clientProject {{ name of your project }} building and running it: npm run build:ssr && npm run serve:ssr Ive got many errors after doing so but I managed to get it to work, but when I access my home page its writing the following to the console: (node:44714) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues.

How to exclude browser modules from being built in Angular 5 Universal app

雨燕双飞 提交于 2019-12-11 02:54:28
问题 I'm trying to create an Angular Universal app building a specific route at build time to inject an AppShell into Index.html page as a means to get meaningful content in front of the user as soon as possible (while Angular app is downloading). I am following the instructions found at Angular University and I have it working as instructed. However, as I systematically add my existing app's functionality into this test app, I'm running into 'Unexpected token import' error stemming from a 3rd

Angular universal only to specific routes

放肆的年华 提交于 2019-12-11 01:09:14
问题 I'm trying to implement angular universal . But I want to limit SSR only in 2 specific routes for the time being. The reasons are . 1) Universal is something still developing and causes some unexpected behaviors with @angular/flex-layout and nested lazy loading 2) I don t need SEO on all pages So i've tried something like this app.get('/campaign/*/*', (req, res) => { res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req }); }); app.get('/', (req, res) => { res.render(join(DIST_FOLDER,

How to use ngx-bootstrap with angular4 with server side rendering

丶灬走出姿态 提交于 2019-12-10 23:35:01
问题 i have installed ngx-bootstrap and using angular-cli 1.0.1 and done universal setup with the help of Roberto Auler's Post. I have added path of bootstrap file in angular-cli.json styles "styles": [ "../node_modules/bootstrap/dist/css/bootstrap.min.css", "styles.css" ], I am using AlertModule for testing and its throwing error C:\Users\Praveen\Desktop\Projects\Angular2\universaltest\node_modules\ngx-bootstrap\alert\alert.module.js:1 (function (exports, require, module, __filename, __dirname) {