node.js - AngularJS - 服务器端渲染

标签 node.js angularjs templates server-side-rendering zombie.js

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

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

最佳答案

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

wiki了解详情

该 repo 的作者更新:那是大约 6 年前(在本次编辑时)。此时,人们可能应该使用 https://angular.io/guide/universal或只是 https://prerender.io/

关于node.js - AngularJS - 服务器端渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16232631/

相关文章:

Eclipse 创建空的 Node.js Express 项目

javascript - 然后 Angularjs 在 for 循环中根据 Promise 运行。如何访问当前项目的索引?

c++ - 访问模板类型实例成员

javascript - Grunt - grunt-xml poke 变量目标名称

node.js - NodeJS 应用程序无法在 heroku 上构建...PhantomJS

json - AngularJS ng-repeat orderBy date 不起作用

javascript - Angular 2 应用程序中的子路由

c++ - 友元函数模板类内定义如何避免重定义错误?

c++ - 无法将多个初始化列表传递给可变参数函数模板

javascript - 类型错误 : Cannot read properties of undefined when sending an EJS form to Express