Tag: angular

量angular器:如何在点击一个button后等待页面完成?

在testing规范中,我需要点击网页上的一个button,然后等待新的页面完全加载。 emailEl.sendKeys('jack'); passwordEl.sendKeys('123pwd'); btnLoginEl.click(); // …Here need to wait for page complete… How? ptor.waitForAngular(); expect(ptor.getCurrentUrl()).toEqual(url + 'abc#/efg');

如何用多个参数调用Angular 2pipe道?

我知道我可以像这样调用pipe道: {{ myData | date:'fullDate' }} 这里datepipe道只有一个参数。 从组件的模板HTML直接在代码中调用具有更多参数的pipe道的语法是什么?

angular-cli服务器 – 如何指定默认端口

在ng serve命令中使用angular-cli,我怎样才能指定一个默认的端口,所以我不需要每次都手动传递–port标志?

Angular2 – HTTP RequestOptions HEADERS

我目前遇到了tslint的一个问题,希望有人能指出我正确的方向。 我试图发送一个HTTP GET请求使用由Angular2框架提供的HTTP。 有了这个请求,我必须指定内容types和承载authentication令牌。 我的代码示例: let headers = new Headers(); let authToken = this._user.getUser().JWT; headers.append('Content-Type', 'application/json'); headers.append('Authorization', `Bearer ${authToken}`); let options = new RequestOptions({ headers: headers }); this._http.get('http://' + url '/', options) .timeout(3000) .subscribe( (res) => { 这个工作,但是,tslint抱怨说 “TS2345:types'{headers:Headers;}'的参数不能分配给types为'RequestOptionsArgs'的参数,属性'headers'的types是不兼容的,types'Headers'不能分配给'Headers'types。这个名字是存在的,但是它们是无关的。'Headers'types中缺less属性'keys'。 我感谢支持。

将所有db中的特定模式授予PostgreSQL中的组angular色

使用PostgreSQL 9.0,我有一个名为“staff”的组angular色,并希望在特定模式的表上授予此angular色的所有(或某些)特权。 以下都不是 GRANT ALL ON SCHEMA foo TO staff; GRANT ALL ON DATABASE mydb TO staff; “职员”的成员仍然无法对架构“foo”中的单个表或者(对于第二个命令的情况下)对数据库中的任何表进行SELECT或UPDATE更新, 除非我在该特定表上授予所有表。 我能做些什么让我和我的用户的生活更轻松? 更新: 在serverfault.com上的类似问题的帮助下找出它。 GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA foo TO staff;

Angular 2组件中的“private”和“public”

如果我不在foo , loadBar和text之前添加私有 ,我相信它们是默认公开的。 export class RandomComponent { @Input() foo: string; @Output() loadBar = new EventEmitter(); text: string; } 在组件中是否有任何用例? 为了封装/安全的原因,我应该总是添加像下面所有的private ? export class RandomComponent { @Input() private foo: string; @Output() private loadBar = new EventEmitter(); private text: string; } 谢谢

只有圆桌angularCSS

我已经search和search,但一直没能find我的要求的解决scheme。 我有一个纯粹的HTML表格。 我想要它的圆angular, 而不使用图像或JS,即纯粹的CSS 。 喜欢这个: angular落细胞的圆angular和细胞1px厚的边界。 到目前为止,我有这样的: table { -moz-border-radius: 5px !important; border-collapse: collapse !important; border: none !important; } table th, table td { border: none !important } table th:first-child { -moz-border-radius: 5px 0 0 0 !important; } table th:last-child { -moz-border-radius: 0 5px 0 0 !important; } table tr:last-child td:first-child { -moz-border-radius: 0 […]

通过模型改变input占位符的值?

我试图改变控制器的input占位符的价值,但不能弄清楚如何。 input(type='text', ng-model='inputText', side='30', placeholder='enter username') 有没有办法修改模型的元素属性?

Angular CLi生成的“spec.ts”文件是什么?

我是新来Angular 2(和angular一般…),我觉得它非常有吸引力。 我正在使用Angular CLi来生成和服务项目。 它似乎运作良好 – 尽pipe对于我的小型学习项目来说,它产生的东西比我需要的多,但这是可以预料的。 我注意到它spec.ts为项目中的每个Angular元素(Component,Service,Pipe等)生成spec.ts 我已经四处search,但还没有find这些文件的解释。 这些使用tsc时通常隐藏的构build文件? 我想知道,因为我想改变我创build的命名不好的Component的名称,并发现这些spec.ts文件中也引用了该名称。 import { beforeEach, beforeEachProviders, describe, expect, it, inject, } from '@angular/core/testing'; import { ComponentFixture, TestComponentBuilder } from '@angular/compiler/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { PovLevelComponent } from './pov-level.component'; describe('Component: PovLevel', () => { let builder: TestComponentBuilder; […]

Angular Cli Webpack,如何添加或捆绑外部js文件?

在将Angular Cli从SystemJs切换到Webpack之后,我不确定如何包含JS文件(供应商)。 例如 选项A 我有一些通过npm安装的js文件。 像这样将脚本标记添加到头标记不起作用。 也不是最好的方式。 <head> <script src="node_modules/some_package/somejs.js"> </head> //With systemJs I could do this <head> <script src="vendor/some_package/somejs.js"> </head> 选项B 包含这些js文件作为webpack包的一部分。 这似乎是可能应该完成的方式。 然而,我不知道如何做到这一点,因为所有的webpack conig似乎都隐藏在angular-cli-webpack软件包的后面。 我想也许有另一个webpackconfiguration,我们可能有权访问。 但是我不确定,因为在创build一个新的angular-cli-webpack项目时我没有看到它。 更多信息: 我想包含的js文件需要包含在Angular项目之前。 例如jQuery和第三方js库,这不是真的为模块加载或打字机设置。 参考资料 https://github.com/angular/angular-cli/blob/master/WEBPACK_UPDATE.md https://github.com/angular/angular-cli/tree/webpack