Tag: 量angular器

Angular2在本地开发中慢速自动刷新页面 – Windows

我是angular2的新手,并遵循docs的英雄教程。 我在angular2上遇到了相当慢的开发经验。 angular2需要大约5秒来检测文件中的变化,然后在30-40秒内重新加载页面。 [0] 8:08:12 PM – File change detected. Starting incremental compilation… [0] app/hero-detail.component.ts(2,8): error TS1192: Module '"app/app.component"' has no default export. [0] 8:08:16 PM – Compilation complete. Watching for file changes. [1][BS] File changed: app\app.component.js [1] [BS] File changed: app\hero-detail.component.js [1] [BS] File changed: app\main.js [1] 16.02.07 20:08:39 304 GET /./index.html (Unknown – […]

使用Passport.jsvalidationangular色和身份validation

所以我想在API中制作一些路由,根据MongoDB中定义的用户angular色显示不同的数据。 这是我现在所拥有的一个样本,它的工作原理 router.get('/test', passport.authenticate('bearer', {session: false}), function (req, res) { if (req.user.role == "premium") { return res.send('you can see this content'); } else { return res.send('you can not see this content'); } }) 然而,最终目标是向用户呈现至less一些东西 ,即使他们没有以正确的angular色login或authentication。 router.get('/test', passport.authenticate('bearer', {session: false}), function (req, res) { if (req.user.role == "premium") { return res.send('this is premium content'); } else […]

错误TS2304:找不到名字'Promise'

大家好,我经历了所有的解决scheme在stackoverflow上。 但是对我来说没有任何工作。 因此张贴问题。 tsconfig.json { "version":"2.13.0", "compilerOptions": { "target": "es5", "module": "commonjs", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": true, "noImplicitAny": false }, "exclude": [ "node_modules" ] } 的package.json { "name": "anguapp", "version": "1.0.0", "description": "Angular2 Gulp Typescript and Express", "main": "dist/server.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "postinstall": "gulp […]

如何用NodeJs缩小Docker镜像的大小

我通过angular-cli创build了新的Angular2应用程序,并在Docker中运行它。 起初,我在本地机器上启动应用程序: ng new project && cd project && "put my Dockerfile there" && docker build -t my-ui && docker run. 我的Dockerfile FROM node RUN npm install -g angular-cli@v1.0.0-beta.24 && npm cache clean && rm -rf ~/.npm RUN mkdir -p /opt/client-ui/src WORKDIR /opt/client-ui COPY package.json /opt/client-ui/ COPY angular-cli.json /opt/client-ui/ COPY tslint.json /opt/client-ui/ ADD src/ /opt/client-ui/src […]

主办Angular 2应用程序

我是Angular 2新手,我知道像GoDaddy这样的共享主机上的主机Angular 1.x ,但我不知道如何发布Angular 2应用程序,例如我有这个结构文件夹: angular2-quickstart –app app.component.ts main.ts –node_modules –typings index.html package.json styles.css systemjs.config.js tsconfig.json typings.json 什么文件我需要上传到FTP? 我什么也没做,因为我不知道该怎么做 提前致谢!

没有导出的成员/节点模块

我正在使用在这里find的5分钟快速入门启动Angular 2 / Typescript。 我遇到了一个看起来很常见的问题,但也许有点不同。 我遇到各种“无出口成员”的问题。 例子: 来自app.module.ts: import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; 返回 …node_modules/@angular2/core/index" has no exported member 'NgModule'. 和 …@angular/platform-browser/index" has no exported member 'BrowserModule'. 从main.ts: import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 抛出: …@angular/platform-browser-dynamic/index" has no exported member 'platformBrowserDynamic'. 我正在运行节点版本4.4.7和npm版本3.10.5。 我明白,这些可能在本教程的上下文中通过回滚节点或npm到与本教程相关的版本来解决。 我想我想要的是解释如何使教程中的代码与当前版本的节点相关。 ETA:这些错误发生在编译,而不是执行。

使用angular2而不使用打印机编译器

我想学习和切换到angular2我的应用程序,但我有打字稿的问题。 问题是我无法使用它。 在我目前的环境中,我不能使用编译器。 即时通讯目前不得不运行node.exe(node.js可执行文件),但不是完整的node.js应用程序只是可执行文件,这意味着我不能运行npm。 但angular2写在打字稿,所以它需要被编译为JavaScript之前被发送到浏览器。 有没有办法我可以得到一个预编译版本的angular2(所以它在JavaScript中),所以我可以在JavaScript中编写我的代码,并让所有的东西没有编译器运行? 如果没有的话,你可以手动安装和使用typecript编译器只有node.exe可执行文件。 要清楚这是因为我不想使用打字稿这是因为在我目前的情况下,我不能安装打字稿。

Angular2 + Laravel与实时和WebSockets

我build立了一个应用程序,我打算与Angular 2和laravel进行实时的战斗。 例如,你点击“攻击”button,你的对手看到他的生活实时下降。 我的应用程序构build于: 前端: Angular 2 后端: PHP Laravel 5.2 现在我正在寻找和学习我的实时战斗部分,我看到了不同的指南和教程: https://www.codetutorial.io/laravel-5-and-socket-io-tutorial/ http://4dev.tech/2016/02/creating-a-live-auction-app-with-angular-2-node-js-and-socket-io/ 第一个教程是关于如何使用Laravel 5和套接字io 。 第二个是如何在NODS JS和socket io上使用Angular 2 。 当我说实时,我的意思是两个用户看到屏幕上发生的相同的事情) 我的后端和前端是完全分开的,我没有安装NodeJS在我的应用程序的任何地方。 这两个用户都需要看到在我的应用程序的战斗中发生的行动,它需要通过我的laravel API,并通过我的Angular 2战斗组件 我的问题是 – 使用Angular2和Laravel 5.2实时应用程序(看起来websockets)的最佳方法是什么,以获得我想要实现的所需结果?

试图编译“zone.js”作为外部模块,但它看起来像一个全局模块

我有“AngularClass”angular2-webpack-starter项目我已经安装了所有的npm依赖现在我试图安装types typings.json { "dependencies": { "zone.js": "github:gdi2290/typed-zone.js#66ea8a3451542bb7798369306840e46be1d6ec89" }, "devDependencies": {}, "ambientDependencies": { "angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#64b25f63f0ec821040a5d3e049a976865062ed9d", "core-js": "registry:dt/core-js#0.0.0+20160317120654", "hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7", "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c", "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729", "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea", "webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4" } } 当我键入 sudo typings install 我有 derzunov:angular2-webpack-starter derzunov$ sudo typings install typings ERR! message Attempted to compile "zone.js" as an external module, but it looks like a global […]

如何在Nodejs中处理angular2pathpath

我正在使用Angular2开发NodeJS应用程序。 在我的应用程序中,我有一个主页和search页面。 对于主页我有一个HTML页面,将呈现为本地主机:3000 /和从主页用户导航到search ie localhost:3000 /search页面,我通过angular2路线处理。 我没有search页面的视图由angular2呈现。 但是当我直接打本地主机:3000 /search,因为我没有这个路由在我的节点的应用程序,它会给出错误。 我不知道如何在节点应用程序中处理这个问题?