Tag: angular2 universal

在Angular Universal应用程序中从ExpressJS获取vaues

我正在构build一个Angular2通用应用程序,我正在整合ng2-translate 。 服务器端我需要知道用户的语言,我可以通过request.acceptsLanguages() ( 见文档 )从ExpressJS获得。 我正确地得到这些值在server.ts像这样: function ngApp(req: any, res: any) { let supportedLangs = req.acceptsLanguages(); console.log('supportedLangs', supportedLangs); res.render('index', { req, res, ngModule: AppModule, preboot: false, baseUrl: '/', requestUrl: req.originalUrl, originUrl: req.hostname }); } 然后我不知道如何通过他们,或访问他们,在我的app.node.module.ts我为服务器设置ng2-translate 。 有没有办法从Angular Universal应用程序(服务器端)访问这些值? 怎么样?

当网站上的文档已过期时,如何安装Angular2?

angular2-universal的维护人员没有更新他们的网站: 问题1) typings install node express body-parser serve-static express-serve-static-core mime –ambient typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead 问题2) typings install node express body-parser serve-static express-serve-static-core mime –global typings INFO globaldependencies "express" lists global dependencies on "node" that must be installed manually typings INFO globaldependencies "body-parser" lists global dependencies on […]