Tag: 量angular器

Angular 2 – 如何传递URL参数?

我已经在Angular 2中创build了一个单页面抵押计算器应用程序,这对我来说就像是一个学习游乐场(试图更习惯当前在工作中使用的技术堆栈)…它运行在http://www.mortgagecalculator123.com如果你想看看它。 如果您想查看,我已经在页面上使用Fork Me链接开源。 无论如何,我想要做的是能够将variables传递给我的应用程序,直接从URL,所以他们可以被我的Angular 2应用程序使用。 就像这样: http : //www.mortgagecalculator123.com/? var1=ABC&var2 =DEF 我试过以下,在我的app.component.ts中,我添加了以下内容: import { Router, ActivatedRoute, Params } from '@angular/router'; AppComponent { private var1: string; private var2: string; constructor( private route: ActivatedRoute, private router: Router ) {} ngOnInit() { this.route.params.forEach((params: Params) => { this.var1 = params['var1']; this.var2 = params['var2']; }); console.log(this.var1, this.var2); } … […]

在严格模式下的节点0.12.x const问题

我正在运行节点v0.12.7,并通过npm安装量angular器。 现在我试图用这个简单的教程来运行conf.js,并且在执行命令protractor conf.js时出现以下错误: [launcher] Process exited with error code 1 C:\Users\ramtin\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\index.js:25 const builder = require('./builder'); ^^^^^ SyntaxError: Use of const in strict mode. at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (C:\Users\ramtin\AppData\Roaming\npm\node_modules\protractor\built\protractor.js:3:17) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) 不能更新节点,因为它会产生依赖关系问题(我正在使用节点0.12.17的已经build好的项目上工作)。 在量angular器上使用–harmony标志不起作用。 […]

Protactor错误,意外的令牌)

我正要开始学习量angular器,并遵循http://www.protractortest.org/#/tutorial中的简单教程 但不幸的是运行这个命令protractor conf.js后得到奇怪的错误 [launcher] Process exited with error code 1 /usr/local/lib/node_modules/protractor/node_modules/q/q.js:126 throw e; SyntaxError: Unexpected token ) at goog.loadModuleFromSource_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1123:19) at Object.goog.loadModule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1085:46) at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6 at Object.Context.closure.goog.retrieveAndExecModule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:135:8) at <anonymous>:1:6 at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:104:12) at Object.goog.importScript_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:879:9) at Object.goog.importModule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:900:14) at Object.goog.writeScripts_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1323:16) at Object.goog.require (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:663:14) 节点版本:v0.10.37 java版本:1.8.0_66 量angular器:版本3.0.0 jadmine:jasmine v2.3.2 jasmine-core v2.3.4 UPDATE 已经克隆存储库https://github.com/angular/protractor 运行以下命令 […]

量angular器在PhantomJS上运行testing

我似乎无法成功通过testingPhantomJS。 我试图将其整合到我的项目中,但之后失败了,我试图运行基本的Angular Docs样本,并得到同样的问题。 我到目前为止的步骤: npm install -g phantomjs phantomjs –webdriver=9515 // … GhostDriver – Main – 在端口9515上运行 protractor protractorConf.js 这是与仅有browserName和seleniumAddress端口更改相同的文件: // An example configuration file. exports.config = { // The address of a running selenium server. seleniumAddress: 'http://localhost:9515', // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'phantomjs' }, // Spec patterns […]

更新到Angular 2后,无法通过Firefox上的Protractor运行Selenium

在将Angular JS 1.4.x更新为Angular 2之后,Seleniumtesting无法通过Firefox上的grunt-protractor-runner运行。 一旦AngularJS被加载,出现以下错误 : D:\…\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108 var template = new Error(this.message); ^ UnknownError: Permission denied to access property "toString" Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12' System info: host: 'NAGWS72', ip: '192.168.210.23', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_79' Driver info: driver.version: unknown at new bot.Error (D:\…\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18) at Object.bot.response.checkResponse (D:\…\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9) […]

在开发环境中使用Angular CLI连接express.js

我find了一个很好的教程,解释了如何使用Angular CLI设置express.js,但在本教程中,angular度应用程序被编译到生产dist文件夹中: https : //scotch.io/tutorials/mean-app-with-angular- 2 -和-的棱angular-CLI 如何将express.js与Angular CLI集成,但我希望express.js能够与Angular应用程序的开发版本一起工作,并且如果我更改了express或angular应用程序,我希望nodemon重新启动。 已经花了八个小时试图让这个工作。 谢谢! 我不想在每次修改Angular应用程序时运行“ng build”(这需要太长的时间) – 我想要在我的angular度应用程序中保存更改时立即重新加载(就像我正在运行'ng serve ')或表示应用程序。 我find了一个教程,在这里你使用Express来连接Angular 2 QuickStart,它可以工作,但是我正在使用Angular CLI。 我知道Angular CLI使用WebPack,而QuickStart使用System.js

AngularJs 2与ASP .NET 4.5.1

我想使用Angular 2作为现有的ASP.NET 4应用程序的前端,即不是MVC 6 / ASP.NET CORE,我宁愿不使用节点,因为我们已经使用nuget作为我们的包pipe理器。 有谁知道任何资源,将指导我通过这个?

如何在没有Node服务器的情况下运行AngularJS2应用程序

是否有可能在浏览器中运行Angular 2应用程序而不使用NodeJS作为服务器。 我不确定,但是如果我理解正确,最新的浏览器能够编译/“理解”TypeScript代码,所以我不必使用任何第三部分js库编译成纯JavaScript? 我想在前端创build一个使用100%Angular 2的应用程序,并使用Ruby On Rails为后端REST API创build一个应用程序,而不使用Rails的页面渲染,会话等。 我有点困惑它如何Angular2工作/幕后运行…我应该如何configuration我的Angular2应用程序使用它没有NodeJS?

尝试从源文本中的npm – 无法识别的令牌安装Angular 2 Material

我从PowerShell尝试以下命令(以pipe理员身份) npm install @angular2-material 并得到错误: Unrecognized token in source text. At line:1 char:13 + npm install <<<< @angular2-material + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnrecognizedToken 我什至尝试只获得一个单一的A2M组件(核心),并得到相同的错误: npm install @angular2-material/{core} 任何想法我做错了什么? npm:3.9.5 节点:6.2.2 操作系统:Win7的 更新: 我在A2M GitHub上发现了以下问题 – 似乎可能是PS的一个问题。 https://github.com/angular/material2/issues/297 更新2: 使用cmd而不是PS工作。

量angular器页面对象inheritance

鉴于我build立我的angularjs量angular器e2etesting套件利用页面对象模式。 而且我把页面目标代码分开放在不同的文件中。 什么是一个好的方法来启用页面对象的inheritance? JavaScript的经典inheritance? 基于Object.create()的inheritance? 其他? 我应该在页面对象内保持期望吗? 还是赞成Martin Fowler 把他们转到断言库 ? 在这种情况下,看起来像这个javascript-nodejs技术堆栈究竟如何? 我在这里准备了一个活的jsfiddle操场,所以你可以尝试你的改进。 或者只是在答案中粘贴代码,我会粘贴下面的jsfiddle内容以求清晰: loginPage.js "use strict"; // A Page Object is a Singleton, so no need to constructors or classic js inheritance, // please tell me if I'm wrong or what's the utility of creating a (new LoginPage()) // every time a spec need […]