Tag: 量angular器

注销会话Angular2 nodeJS

我有一个Angular2应用程序和NodeJS服务器。 我被困在实施注销。 如果我简单地使用req.session.destroy() ,它对Angular2一方没有任何影响。 Angular2仍然认为用户login。(因为当我调用返回login用户的数据的方法,它仍然会返回它 – 即使它需要req.session.user返回这个数据)。 我看到了这个问题的一些解决scheme,但我看到的只是使用localStorage(在localStorage中保存用户,然后在单击注销后删除它)。 有没有其他更有效的方式告诉从NodeJS的Angular2用户已经注销,会话已经结束?

Angular jquery插件 – jQuery没有在插件中定义

我尝试在我的Angular项目中导入jquery-knob插件,所以我通过npm安装了jquery – 工作正常。 现在我想添加jquery旋钮(也通过npm),但我得到这个错误,我认为它在 jquery.knob.min.js Uncaught ReferenceError: jQuery is not defined at eval (eval at webpackJsonp.310.module.exports (addScript.js:9), <anonymous>:1:85) at eval (eval at webpackJsonp.310.module.exports (addScript.js:9), <anonymous>:1:95) at eval (<anonymous>) at webpackJsonp.310.module.exports (addScript.js:9) at Object.155 (jquery.knob.min.js?4d31:1) at __webpack_require__ (bootstrap aa173b5…:52) at Object.351 (addScript.js:10) at __webpack_require__ (bootstrap aa173b5…:52) at webpackJsonpCallback (bootstrap aa173b5…:23) at scripts.bundle.js:1 在.angluar-cli.json "scripts": [ "../node_modules/jquery-knob" […]

Aurelia e2e:检查div内的跨度是否包含特定的文本

我想看看是否包含在本身包含在一个div中的文本包含某些文本。 这是HTML: <div class="funds"> <span>banking</span> <span class="ml-sm"> <b>EUR 1,000</b> </span><!–anchor–> </div> 我想检查<span class="ml-sm">包含“EUR”。 我试图做的一个方法(其他几个)是: var checkFunds = element(by.id("ml-sm")); if (checkFunds.getText().toContain('EUR'&'GBP')) { //do something } 我得到一个错误说.toContain()不是一个函数。 关于如何进行,我有点不知所措。

量angular器:text.indexOf(…).isDisplayed不是一个函数

我知道这已经被问了几次,即使我已经看过这些问题,我不知道如何解决这个问题。 我正在检查文本“EUR”是否包含在一个名为“货币”的div中。 以前这个工作对我来说很好,但是我已经开始使用lint了,而且我也遇到了很多这样的错误。 这是我得到的错误Failed: text.indexOf(…).isDisplayed is not a function 这是我的代码 checkBuyerCurrency (text, buyerCurrency) { let currencyPromise = new Promise(function (resolve, reject) { const commonUtils = new CommonUtils(); var EC = protractor.ExpectedConditions; browser.wait(EC.visibilityOf(element(by.className("currency")), 4000)); var checkCurrency = element(by.className("balances")); checkCurrency.getText().then(function (text) { expect (text.indexOf("EUR").isDisplayed()).toBe(true); console.log("EUR only buyer"); }); }); } 我是否需要将textvariables或将其转换为string? 由于我使用Expect语句的方式,我不完全确定如何做到这一点 谢谢你的帮助

将Json数据从服务器存储到Angular 2中的数组中

我使用nodejs服务器从SQL数据库中获取数据。 我会将数据存储在Tache数组中: getTaches(): Observable<Tache[]> { return this.http.get(this.tachesUrl) .map(response => { this.taches = response.json().data as Tache[]; console.log(this.taches); }) .catch(this.handleError); } 当我在控制台上打印时,我得到的结果如下: undefined 当我打印response.json()我得到我的价值观: Object {taches: Array(8)} 所以我删除.data,然后再试一次,然后我在模板文件的第一行得到另一个错误: ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed 这是我的html文件: <md-toolbar color="primary"> <span>Taches non traitées</span> </md-toolbar> <md-card> <md-list > <ng-container *ngFor="let tache of this.tacheService.taches […]

带有Angular2的Auth0“提供的参数不匹配调用目标的任何签名”。

我目前正在尝试用我的Angular2应用程序设置Auth0。 我正在使用angular2-cli。 我添加了一个称为auth的新服务。 当我运行npm start我得到错误src/app/auth.service.ts (21,5): Supplied parameters do not match any signature of call target. 这是我的auth.service.ts import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import 'rxjs/add/operator/filter'; import * as auth0 from 'auth0-js'; @Injectable() export class AuthService { auth0 = new auth0.WebAuth({ clientID: 'removed for privacy', domain: 'removed for privacy', responseType: […]

如何计算multidimensional array中的项目总数?

下面是我用来从我的转发表中检索数据的代码。 这给出了multidimensional array的输出。 请检查输出。 我想获得整个multidimensional array中的项目总数和每个数组中的项目总数。 更详细地说,整个multidimensional array有30个项目,每个数组中有6个项目我想要得到这两个值。 如何计算这两个值? var RepeaterTable = element.all(by.repeater("view in ctrl.view track by $index")).each(function(rowelem,index){ rowelem.getText().then(function(BlockTrans){ console.log("****index and RowElem\n"+index+"\n",BlockTrans); var item = BlockTrans; }); }); 输出上面的代码 0 Morrison Male Jun 22, 2017 26 Yes Edit ****index and RowElem 1 Steven Male Jun 22, 2017 39 Yes Edit ****index and RowElem 2 Emy […]

在Angular 2 cli项目中集成bootstrap

面对将Bootstrap与angular色2 cli集成的问题。 我是新的angular2 CLI请指导我,纠正我,如果我正在做我的步骤错了。 提前致谢。 步骤如下: 1. npm install bootstrap @ next –save 2.修改.angular-cli.json文件 这是我修改的: "styles": [ "../node_modules/bootstrap/dist/css/bootstrap.css", "styles.scss" ], "scripts": [ "../node_modules/jquery/dist/jquery.js", "../node_modules/tether/dist/tether.js", "../node_modules/bootstrap/dist/js/bootstrap.js" ], 用ng服务重新启动应用程序 发生错误如下: 在多脚本加载器中出现错误!./〜/ jquery / dist / jquery.js script-loader!./〜/ tether / dist / tether.js script-loader!./〜/ bootstrap / dist / js / bootstrap.js找不到模块:Error:无法parsing'/ Users / sagarbhanushali / projectangularcliyoutube / myProject […]

量angular器无法访问其类共享其他元素的特定元素

我试图访问一个特定的元素,但元素名称在同一页面中的其他元素之间使用 这是html <div class="details of buyer"> <div class="field"> <small>Balance</small> <div>5000</div> </div> <div class="field"> <small>Lodgements</small> <div>108,000.00</div> </div> <div class="field"> <small>Max Withdrawal</small> <div>107,561.00</div> </div> <div class="field"> <small>Credits</small> <div>-</div> </div> <div class="field"> <small>Interest Rate</small> <div>-</div> </div> <div class="field"> <small>Net Gain</small> <div>-</div> </div> <div class="field"> <small>Net Yield</small> <div>-</div> </div> </div> 我试图从下面的<small>Max Withdrawal</small> <div>107,561.00</div>检索“107,561.00” <small>Max Withdrawal</small> <div>107,561.00</div> 我试过这个在我的页面对象文件,但它返回“索引超出界”…. var checkBalance= […]

如何避免通过SauceLabs远程下载文件时的“另存为”提示

从Jenkins作业运行的量angular器规格,连接到SauceLabs。 它点击一个button来下载PDF,并检查文件是否成功下载。 我无法使Chrome浏览器使用绝对path打开“另存为”提示。 如果我使用'~/Downloads'作为filename ,但是我的browser.wait等待文件存在永远挂起,我可以避免“另存为”提示。 // spec.js import fs from 'fs' import path from 'path' fs.mkdirSync('./downloads') describe('Clicking DOWNLOAD button', () => { it('should download a proposal', () => { const filename = path.resolve(__dirname, './downloads/proposal.pdf') if (fs.existsSync(filename)) { fs.unlinkSync(filename) } page.downloadProposalBtn.click() browser.wait(() => fs.existsSync(filename), 180000) .then(() => { expect(fs.existsSync(filename)).toBe(true) }) }, 180000) }) 以下是我的conf文件的相关部分。 我期望的prompt_for_download设置,使提示不显示,但它.. // […]