I am a student, and still very new to web development. Recently, I have come across angular 1.x, react.js, and angular 2 (Ultimately decided to land on angular 2).
One thing that have hung in my mind lately is server-side pre-rendering. In my thought, this server-side pre-rendering is doing the job of server template processor (Like jade.js. I haven't tried it though). The difference is that the js templating code can be reused on client-side. Is my understanding correct? Does it mean that we can use angular 2 or react in place of other templating engines?
问问题
5298 次
2 回答
3
Angular 2 的服务器端渲染并没有取代模板引擎。
服务器端渲染让您可以像往常一样编写 Angular 2 代码(使用或不使用 Jade 之类的东西)。服务器呈现用户将看到的第一页,因此用户在加载 javascript 时不会查看空白页。这减少了感知的页面加载时间,并使网站更容易被网络爬虫访问。
该视频展示了如何在 Angular 2 中实现服务器端渲染。评论中有一些指向初始存储库的链接。
于 2016-01-29T21:24:06.447 回答
0
Angular 2 Universal 是由 PatricJS 和 Jeff Wepley 开发的服务器渲染项目。这是 git 中维护的项目。这是新手的种子。
用法:
git clone https://github.com/angular/universal-starter/
git checkout systemjs
于 2016-03-08T08:52:30.790 回答