AngularJS - 服务器端渲染 [英] AngularJS - server-side rendering

查看:41
本文介绍了AngularJS - 服务器端渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可能知道,AirBnb 开源了 Rendr (http://nerds.airbnb.com/weve-open-sourced-rendr) 应该启用Backbone 应用程序的服务器端渲染.这很酷,因为您可以在服务器上运行模板渲染的第一次迭代",客户端将获得完全渲染的 HTML 文档以及整个 JS 应用程序.它大大减少了显示时间,并且可以让我们摆脱其他服务器端模板系统.

As you may know, AirBnb opensourced Rendr (http://nerds.airbnb.com/weve-open-sourced-rendr) which should enable server-side rendering of Backbone apps. This is cool, because one can run the first "iteration" of template rendering on the server and the client gets fully rendered HTML document plus the whole JS app. It greatly reduces time-to-display and can get us rid of other server-side templating systems.

那么,有人设法用 jsdom 或 ZombieJS 渲染 AngularJS?Node.js 上的这些 dom/浏览器模拟理论上应该足以用于简单的服务器端 Angular 模板,但我发现在谷歌上搜索它的结果并不是很确定.

So, have someone managed to render AngularJS with jsdom or ZombieJS? These dom/browser emulations on Node.js should in theory be enough for simple server-side Angular templating, but results I found googling it were not very conclusive.

推荐答案

这是另一个解决方案:https://github.com/ithkuil/angular-on-server

wiki 详情

该存储库作者的更新:那是大约 6 年前(在进行此编辑时).在这一点上,人们可能应该使用 https://angular.io/guide/universal 或只是https://prerender.io/

Update from author of that repo: that was about 6 years ago (at the time of this edit). At this point, people should probably be using https://angular.io/guide/universal or just https://prerender.io/

这篇关于AngularJS - 服务器端渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆