angular-universal

Angular 4 with universal

主宰稳场 提交于 2019-12-08 11:23:03
问题 I am using angular 2 with a 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: [

Angular Universal only showing page source for first page

筅森魡賤 提交于 2019-12-08 09:12:04
问题 I have an Angular Universal web app running on a shared web server. I ran it with a tool that is in my DirectAdmin called NodeJS Selector. With this I could npm install and server:ssr the server.js file. It's working, I can browse to all my pages and I see all the content. The problem however is in the page source. When I go the base url (www.example.com/) and I right-click => 'view page source', I can see the content of the home page just like Universal is supposed to do. But when I go to

How to get full url in Angular?

拥有回忆 提交于 2019-12-08 06:31:43
问题 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}

Deploy Angular4 Universal app in Azure invalid start-up command

萝らか妹 提交于 2019-12-08 03:33:19
问题 I have created a simple application with Angular 4.0.0 and Universal (platform-server) following these steps Basically it means that it's an Angular 4 application capable of being rendered in server side within a NodeJs environment. Now I want to deploy this application to my Azure app services using Git and a command line so I followed these steps. Basically: I installed Azure-Cli 2.0 for Windows Open command line (cmd) Run az login , it will ask to open a url and enter a code so that we can

Deploy angular rendered app on shared server

余生颓废 提交于 2019-12-07 18:19:41
I created an Angular 7 app and built it using Angular universal to make it SEO friendly. However, as I was reading, it is not possible to deploy it now on a shared server (once build with Angular universal, otherwise it is possible), since it requires Node.JS to run the script file on server. My problem is that my hosting plan is on a shared server so I will not be able to run it using Node.JS but I still care of having my app SEO friendly. What can be a good solution? Angular Universal renders your application in server side before serving the page (SSR). Indeed you will need nodejs to make

How to use localStorage in angular universal?

柔情痞子 提交于 2019-12-07 15:37:58
问题 I am using @angular v4.0.3 and webpack 2.2.0. It was working fine using Auler post but as I included localStorage it stopped working. Is there any way to make it work or any module for localStorage in angular universal 回答1: A good way is to make localStorage an injectable and provide different implementations for it. An abstract class that reflects Storage API can be used as a token: export abstract class LocalStorage { readonly length: number; abstract clear(): void; abstract getItem(key:

Why is res.render in Angular Universal taking so long?

若如初见. 提交于 2019-12-07 13:15:46
问题 I am building a Angular Universal App and all i have now is the Structure of the site. I did everything like in the tutorial concerning transforming my app for Angular Universal. console.log("got Request " + new Date()); res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req , time: true}, function(err, html) { console.log("finished Rendering " + new Date()); res.send(html); } ); The Rendering takes up 3 and a half seconds.. This seems like a huge amount of time to me. Also in the

Angular Universal server rendering WebSocket

只谈情不闲聊 提交于 2019-12-07 01:22:58
问题 Are there any examples of Angular Universal with WebSockets? Serverside rendering does not know wat a WebSocket object is in my case. And if I use socket.io the node server hangs when trying to make a connections. Some additional information about the problem: I downloaded angular-universal-starter from github: https://github.com/angular/universal-starter Which works fine out of the box running 'npm install' and 'npm start' But after i added the following code to AppComponent export class

How to deploy Angular Universal project to standard hosting?

冷暖自知 提交于 2019-12-06 13:49:18
问题 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. 回答1: 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

aspnetcore with angular error NodeInvocationException: The Node invocation timed out after 60000ms

♀尐吖头ヾ 提交于 2019-12-06 08:52:29
问题 i'm using yo generator-aspnetcore-spa once i run the app i got problem An unhandled exception occurred while processing the request. NodeInvocationException: The Node invocation timed out after 60000ms. You can change the timeout duration by setting the InvocationTimeoutMilliseconds property on NodeServicesOptions. The first debugging step is to ensure that your Node.js function always invokes the supplied callback (or throws an exception synchronously), even if it encounters an error.