Angular 4 Universal Lazy Loading Error

I have set up a new Angular CLI project to learn how to enable server-side rendering using Angular Universal. I've set is up and everything is working great, but I decided to lazy-load a module called 'lazy'. I did that, when using ng serve it works, but when Universal is running (with AOT), when I go to the lazy route and refresh the page I get this error, although I see the lazy

Angular 4通用延迟加载错误

我已经创建了一个新的Angular CLI项目,以了解如何使用Angular Universal启用服务器端渲染。 我已经设置好了,一切都很好,但我决定懒加载一个名为“lazy”的模块。 我这样做,当使用ng serve它的工作,但当通用运行(与AOT),当我去懒惰的路线和刷新页面我得到这个错误,虽然我看到浏览器中的懒惰组件: ERROR { Error: Uncaught (in promise): ReferenceError: System is not defined ReferenceError: System is not define

Do we require webpack for angular universal?

I am new to angular 2 and created a simple page in angular 2. Now I want to use server side rendering for my page.I read about angular universal and decided to use it. But few doubts before starting. Do we need webpack to implement it.Because i have not used webpack in my application(used basic Quickstart to givven here https://angular.io/guide/quickstart) I tried to use universal but gett

我们是否需要webpack进行角度通用?

我是angular 2的新手,并且创建了角度为2的简单页面。 现在我想为我的页面使用服务器端渲染。我阅读了关于通用角度并决定使用它。 但开始之前几乎没有疑问。 我们是否需要webpack来实现它。因为我没有在我的应用程序中使用过webpack(使用基本的快速入门来https://angular.io/guide/quickstart) 我试图使用通用,但得到一些错误,所以想确认。 请让我知道,如果我可以使用角度通用没有webpack。

Server Side Rendering with Angular and Node

I was using the server side rendering concept in Angular for UI and Server is on Node.js. So what I was doing is rendering the HTML Part when I hit API from Angular Component and that rendered part is shown on the Screen. Now the Problem is their are some anchor TAGS with href example- href='/dashboard/cop/batting' HTML rendered from API. Now when I click this link my whole angular

带角度和节点的服务器端渲染

我在Angular中为服务器端渲染概念使用UI,服务器在Node.js上。 所以当我从Angular Component点击API时,我正在做的是渲染HTML Part,并且屏幕上显示了渲染的部分。 现在的问题是他们是一些与href锚点标签 example- href='/dashboard/cop/batting'从API呈现href='/dashboard/cop/batting' HTML。 现在当我点击这个链接时,我的整个角度应用程序RESTARTS和app.module.ts然后设置路由。 这花了很多时间,

Progressive Angular App With Server Side Rendering Not Building Index

Im building a progressive angular app that uses angular universal for server side rendering. Im having trouble getting the SSR to work. This app is hooked up to postgres and uses express/node on the backend. The exact issue is when running the server, I cannot load the app. I am getting an error that says it cannot find the index file but I am seeing the index file in the dist folder which is

带有服务器端渲染的渐进式角应用程序不构建索引

我建立一个渐进的角度应用程序,使用角度通用的服务器端渲染。 我无法使SSR正常工作。 这个应用程序连接到postgres,并在后端使用express / node。 确切的问题是运行服务器时,我无法加载应用程序。 我得到一个错误,说它找不到索引文件,但我看到dist文件夹中的索引文件,它声称找不到索引文件。 我得到的错误 Error: Failed to lookup view "index" in views directory "./dist" at Function.render (/Users/jonatha

Google Analytics / Client Side Only Code

So I'm trying to migrate our site from a static SPA to Angular Universal Rendered Server Side and I'm having an issue with Google Analytics. In my SPA I define GA in the index.html via the html script but with Server Side Rendering this obviously doesn't make sense. I tried to: if(ga) { ga.create(...); } to get it to run only when ga is initialized (which it should be on the

Google Analytics /客户端专用代码

因此,我试图将我们的网站从静态SPA迁移到Angular Universal Rendered Server Side,并且我遇到了Google Analytics问题。 在我的SPA中,我通过html脚本在index.html中定义了GA,但在服务器端渲染中这显然没有意义。 我尝试过了: if(ga) { ga.create(...); } 让它只在ga被初始化时运行(它应该在客户端但不在服务器上),但是我得到一个未定义的对象错误(ReferenceError:ga未定义 - 在if(ga)行),其中没有定义应该

Angular 5 Universal: Using server.ts in Development

I used the new Angular Universal Starter to start a new Angular 5 project. For the new release they only give the Angular CLI version as a starter. Everything works fine and I can run my project in production with npm run serve:ssr etc. But: I have a custom API for the node.js/express server that acts as a wrapper for my backend. When starting the project in development with ng serve or npm

Angular 5 Universal:在开发中使用server.ts

我使用了新的Angular Universal Starter来开始一个新的Angular 5项目。 对于新版本,他们仅将Angular CLI版本作为首发。 一切工作正常,我可以用npm run serve:ssr等在生产环境中运行我的项目。 但是:我有一个为node.js / express服务器定制的API,它充当我后端的包装器。 当使用ng serve或npm run start开发项目npm run start我有一个可以自动重新加载文件更改的Angular应用程序。不幸的是,在开发过程中, server.ts文

Huge number of files generated for every Angular project

I wanted to start a simple hello world app for Angular. When I followed the instructions in the official quickstart the installation created 32,000 files in my project. I figured this is some mistake or I missed something, so I decided to use angular-cli, but after setting up the project I counted 41,000 files. Where did I go wrong? Am I missing something really really obvious? There is

为每个Angular项目生成大量文件

我想为Angular创建一个简单的Hello World应用程序。 当我按照官方快速入门中的说明进行安装时,我的项目中创建了32,000个文件。 我认为这是一些错误,或者我错过了一些东西,所以我决定使用angular-cli,但是在建立项目之后,我计算了41,000个文件。 我哪里做错了? 我错过了真正明显的东西吗? 你的配置没有问题。 Angular(自2.0版以来)使用npm模块和依赖项进行开发。 这是你看到这么多文件的唯一原因。 Angula

How to send an HTTP request with a header parameter?

I'm very new to javascript and web programming in general and I need some help with this. I have an HTTP request that I need to send through javascript and get need to store the output in a variable. I tried using just the call url: https://api.fantasydata.net/nfl/v2/JSON/PlayerSeasonStats/2015 But it returns an authentication error because I didn't send my API key and it doesn't

如何发送带有头部参数的HTTP请求?

我对JavaScript和网络编程一般都很陌生,我需要一些帮助。 我有一个HTTP请求,我需要通过JavaScript发送,并需要将输出存储在一个变量中。 我试着只使用调用url: https://api.fantasydata.net/nfl/v2/JSON/PlayerSeasonStats/2015 但是它返回一个认证错误,因为我没有发送我的API密钥,也没有告诉我如何在URL中完成。 API密钥被列为标题而不是参数,我不知道该如何处理。 我尝试过使用XMLHttpRequest()类,但我不太确定

Making a keyframes restart on click

I have bubbles that float up using keyframes, but they are buttons that I also want to disappear when clicked and then have it automatically restart at 0% . I have been calling onmousedown and onmouseup to do this but it doesn't seem to be working. Any ideas? $(document).ready() { function Bubbles() { $(".bubble_cluster_one").css("opacity", "0"); } function Bubbles2() {

点击重新启动关键帧

我有使用关键帧浮起来的气泡,但是它们是我也想单击时消失的按钮, 然后让它自动重新启动为0% 。 我一直在呼吁onmousedown和onmouseup做到这一点,但它似乎并没有工作。 有任何想法吗? $(document).ready() { function Bubbles() { $(".bubble_cluster_one").css("opacity", "0"); } function Bubbles2() { $("bubble_cluster_one").css("top": "400px", "opacity": "1"); } }.bubble_cluster_

Google Analytics force HTTPS to prevent 307 Internal Redirect

When Google Analytics sends data from an http page, it starts out as an http request like so: http://www.google-analytics.com/collect?payload-data-goes-here But this causes a 307 status code (Internal Redirect) due to HTTP Strict Transport Security (HSTS), and this redirect is the https version of the exact same URL. How do I force Google Analytics to only send one https request from an htt

Google Analytics强制HTTPS阻止307内部重定向

当Google Analytics从http页面发送数据时,它将以http请求的形式开始,如下所示: http://www.google-analytics.com/collect?payload-data-goes-here 但由于HTTP严格传输安全性(HSTS),这会导致307状态码(内部重定向),并且此重定向是完全相同URL的https版本。 如何强制Google Analytics只发送来自http页面的一个https请求? 解决方案是使用ForceSSL 。 这迫使Google Analytics始终通过https发送数据。 的analyti