Tag: 量angular器

如何检查一个元素是否与量angular器不可点击?

testing一个元素是否可以用量angular器点击是微不足道的,但我被困在我的脑海里试图弄清楚如何检查一个元素是不是可点击的。 我试图把try / catch中的click函数包装起来,这样当试图点击它的时候就会抛出一个错误,应该抓住它并让testing通过; 但是,这是行不通的。 这是我的代码检查方法: return this.shouldSeeDisabledFunds() .then(function() { var clickable = true; try { fundsElem.first().click(); } catch (e) { clickable = false; console.log(clickable); } finally { console.log(clickable); } console.log(clickable); // All the way through, clickable is still true, and the console log in the // catch is not called. I believe this is […]

强制量angular器onPrepare等待asynchronoushttp请求

我的量angular器conf.js, onPrepare函数需要做一个http请求,看起来像, onPrepare: function(done) { request.get('http://pepper/sysid') .end(function(err, resp){ if(err || !resp.ok){ log("there is an error " + err.message) done() }else{ global.sysid = resp.sysid done() } }) 它抛出的错误, done is not a function 有没有其他的方法,我可以强制在我的testing开始执行之前调用onPrepare的callback?

Angular 2需要库

我想开始使用Angular2 Beta,但是我正在面对一些关于所需库的问题。 我正在使用Eclipse,它是TypeScript插件 。 另外,我使用SystemJS作为模块加载器。 我的问题是,如果我使用npm install angular2它会加载整个Angular-Project,包括CommonJS -Version, ES6 Version和TypeScript -Version。 这导致超过30 MB的大文件夹几乎2000个文件,但我只需要TypeScript版本(仍然有几百个文件),没有例子。 另外,在Eclipse导入/ts -folder会给我错误,“rxjs”中的模块不存在(“rxjs / Subject”…)。 所以我想我也必须下载这个项目。 使用5 Min Quickstart中使用的package.json , npm install下载超过80MB(几乎10000个文件),我相信,我不需要所有这些文件。 所以我想知道, Angular2真正需要哪些文件,我如何下载它们? 我应该创build我自己的package.json文件吗? 还是有更简单的方法? 编辑:看看我们的(工作)Angular的1.X项目,我可以看到一个单一的angular.js文件,以及不同模块的文件(如restangular.js,angular-route.js等),在总共约10个文件。 我现在正在寻找的是这些文件的angular2对应。 那些同行是否存在? 我在哪里可以find他们?

Angular2构build错误 – 找不到types

我有类似的问题。 当我运行npm start我得到以下错误: > tsc && concurrently "npm run tscw" "npm run lite" node_modules/@angular/common/src/directives/ng_class.d.ts(72,35): error TS2304: Cannot find name 'Set'. node_modules/@angular/common/src/facade/async.d.ts(27,33): error TS2304: Cannot find name 'Promise'. node_modules/@angular/common/src/facade/async.d.ts(28,45): error TS2304: Cannot find name 'Promise'. node_modules/@angular/common/src/facade/lang.d.ts(4,17): error TS2304: Cannot find name 'Map'. node_modules/@angular/common/src/facade/lang.d.ts(5,17): error TS2304: Cannot find name 'Set'. node_modules/@angular/common/src/facade/lang.d.ts(70,59): error TS2304: Cannot find name 'Map'. […]

Angular 2 SimpleChanges Object在第一个npm开始时抛出错误

在我的angular2应用程序中有一个组件,其中包含一个对象数组,将所选(单击)的对象传递给它的直接子组件。 这会显示更详细的数据。 我正在使用“SimpleChanges”function来观察这个子组件,如果给定的对象改变成另一个http请求来从数据库中获取相关的注释。 如果我尝试用npm构build它,我会得到一个错误,并说: app / displayEntry.component.ts(23,41):错误TS2339:types'SimpleChanges'上不存在属性'entry' 如果我只是评论这部分,启动npm,并最终把它放在那里,并保存它,没有问题了(没有错误,它的工作原理)。 我的问题是,是否有办法解决这个问题,这会导致什么麻烦,以后我不能预见,还是应该忽略它? 谢谢你的帮助 父组件: import { Component, OnInit } from '@angular/core'; import { entry } from './Objekte/entry'; import { entryService } from './entry.service' @Component({ templateUrl: 'app/Html_Templates/displayLastEntrys.template.html' }) export class displayLastEntrys implements OnInit{ public entrys : entry[]; private entryChoosen: boolean; private ChoosenEntry : entry; constructor ( private entryservice : […]

为量angular器e2etesting设置环境参数

我们正在使用量angular器来testing我们正在构build的前端angular度应用程序。 目前我们正在使用browser.get()来指定我们希望再次testing的环境(localhost:9000,staging,UAT),但是我想参数化这个,所以当我们使用grunt test:e2etesting来运行我们的testing时grunt test:e2e我们可以指定一个参数将browser.get()更改为指定的环境。 像能够调用grunt test:e2e NODE_ENV=uat来testing指定的环境。 任何人有任何见识如何做到这一点?

Angular2:并发不被识别为内部或外部命令

当使用npm start运行server2 for angular2时出现错误,说明并发不能被识别为内部或外部命令,为什么会发生这种types的错误 这里是package.json: { "name": "contactlistapp", "version": "1.0.0", "description": "The app", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "tsc": "./node_modules/.bin/tsc", "tsc:w": "./node_modules/.bin/tsc -w", "serve": "./node_modules/.bin/live-server –host=localhost –port=3000 .", "start": "concurrent \"npm run tsc:w\" \"npm run serve\" " }, "author": "Sarah", "license": "ISC", "dependencies": { "express": "^4.13.3", "angular2": "2.0.0-beta.0", "systemjs": […]

找不到'core-js'的types定义文件

我正在用angular-cli构build一个angular2应用程序。 angular-in-memory-web-api未被默认安装。 所以我search了它,并在我的package.json文件中添加了这一行"angular-in-memory-web-api": "~0.1.5" 。 并没有npm install 。 现在我有这个问题。 ERROR in [default] /home/adil/Code/AngularJS.2/cli-based/mz-doc-app/node_modules/angular-in-memory-web-api/in-memory-backend.service.d.ts:1:0 Cannot find type definition file for 'core-js'. 请提出一些解决scheme? package.json { "name": "mz-doc-app", "version": "0.0.0", "license": "MIT", "angular-cli": {}, "scripts": { "start": "ng serve", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "~2.1.0", "@angular/compiler": […]

如何在angular度2中使用codelyzer

我想在我的项目中使用codelyzer,我使用systemjs和没有webpack。 我添加了一个tslint到我的项目,并使用npm开始运行项目,但它没有从我的项目中得到任何错误,即使我没有在我的项目中使用正确的风格指南我该怎么做使用codelyzer?

如何将ExpressJS服务器与Angular2集成

我尝试用NodeJS(Express)创build一个angular2应用程序作为服务器。 问题在于,由于Express试图使用自己的模板引擎并路由请求,而angular也使用routes和index.html作为入口点,所以存在冲突。 我怎样才能整合?