我想使用Protractor端到端测试我们的angular 2应用程序,但我坚持使用以下消息:
"Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds."
Run Code Online (Sandbox Code Playgroud)
我的conf文件.
exports.config = {
directConnect: true,
specs: ['spec.js'],
// For angular2 tests
useAllAngular2AppRoots: true,
}
Run Code Online (Sandbox Code Playgroud)
Chrome已打开,网站也已打开,直到超时才会发生任何事情.
禁用同步时(使用browser.ignoreSynchronization = true;),就可以了.但我失去了"自动等待"功能,这是使用Protractor的主要优势之一.
该应用程序完全基于角度2.所以为什么这不起作用?
我们的开发人员告诉我,我们不是轮询(根据Protractor文档可能的原因之一).顺便说一句,我们正在使用websocket架构.我不知道是否有链接.
实际上,我根本不知道如何解决这个问题.
有人可以帮帮忙吗?
我想在一个没有填充底部input-group的Bootstrap glyphicon中使用自定义图像(我的图像触摸按钮的底部),如下图所示:
实际上,我使用Bootstrap glyphicon glyphicon-search:
<div class="input-group">
<input type="text" class="form-control" placeholder="Rechercher un produit, une référence ..."/>
<span class="input-group-addon">
<span aria-hidden="true" class="glyphicon glyphicon-search"></span>
<span class="hidden-xs text-upper-style">
Rechercher</span>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我的问题是我无法在搜索栏中用我的图片替换glyphicon.
我试图创建CSS以模仿Bootstrap的那些,但它总是变坏:
CSS
.glyphi {
position: relative;
top: 1px;
display: inline-block;
font-style: normal;
font-weight: normal;
line-height: 1;
float: left;
display: block;
}
.glyphi.search {
background: url(../img/header/search.png);
background-size: cover;
}
.glyphi.normal {
width: 28px; //But Bootstrap glyphicon is 16x16...
height: 16px;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<span class="glyphicon glyphicon-search"></span>
Run Code Online (Sandbox Code Playgroud)
请注意,我的图像不是方形(60x37像素).
这是应该取代的图片glyphicon …
我有这个angular2模板:
<template *ngIf="alerts.length > 0">
<alert *ngFor="let alert of alerts;let i = index" [type]="alert.type" dismissible="true" (close)="closeAlert(i)">
{{ alert?.msg }}
</alert>
</template>
Run Code Online (Sandbox Code Playgroud)
我收到这些错误:
zone.js:461 Unhandled Promise rejection: Template parse errors:
Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with * (" </div>
<div *ngSwitchCase="false" class="container p-t-10">
<alert *ngIf="alerts.length > 0" [ERROR ->]*ngFor="let alert of alerts;let i = index" [type]="alert.type" dismissible="true" (close)="closeAlert"): b@5:37
Run Code Online (Sandbox Code Playgroud)
我把*ngIf和*ngFor放在不同的html元素中是什么问题.它应该工作.没有?
和:
Can't bind to 'type' since it isn't a known …Run Code Online (Sandbox Code Playgroud) 我想在OS X上调试Firefox代码.我正在阅读这个页面,它告诉我:
现在您需要添加可执行文件.选择Project> New Custom Executable并键入一个漂亮的名称,然后单击Choose按钮找到要调试的.app文件(Mozilla.app,Firefox.app,DeerParkDebug.app等)..app文件是
但是使用xcode 4没有Projects菜单.我似乎无法找到如何添加自定义可执行文件.我已成功构建Firefox但我无法调试它,因为我不知道如何在Xcode 4中添加可执行文件.我怀疑链接中的步骤是针对Xcode 3的.
我正在使用升级适配器逐步升级我的应用程序.我的应用程序使用ui-router(+有子路由).
我在Angular 2中阅读了这篇关于路由的好文章.我的问题是:
是否可以在Angular 1.X app +升级适配器中使用新路由器?
例如:
我有一个角度1.X模板<div ui-view=""></div>.当我将它升级为Angular 2.0组件时,我必须使用新的组件路由器,因为Angular 2.0现在正在渲染这个组件.但是,为了使用它,我应该这样做:
bootstrap(App, [provide(LocationStrategy, { useClass: PathLocationStrategy })])
Run Code Online (Sandbox Code Playgroud)
使用Upgrade Adater引导时我没有这个!
我应该首先将引导程序移动到Angular 2,然后再移动到Component路由器吗?
谢谢
我有一个Web API方法:
public List<Task> GetTasks([FromUri] TaskFilter filter)
{
}
Run Code Online (Sandbox Code Playgroud)
该方法具有带可空标识符列表的参数:
public class TaskFilter
{
public IList<int?> Assignees { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我打电话的时候:
GET /tasks?assignees=null
Run Code Online (Sandbox Code Playgroud)
服务器返回错误:
{
"message":"The request is invalid.",
"modelState": {
"assignees": [ "The value 'null' is not valid for Nullable`1." ]
}
}
Run Code Online (Sandbox Code Playgroud)
它只有在我传递空字符串时才有效:
GET /tasks?assignees=
Run Code Online (Sandbox Code Playgroud)
但是标准查询字符串转换器(来自JQuery, Angular等)不能以这种方式使用空值.
如何让ASP.NET解释'null'为null?
Upd:查询字符串可以包含多个标识符,例如:
GET /tasks?assignees=1&assignees=2&assignees=null
Run Code Online (Sandbox Code Playgroud)
Upd2: JQuery将数组中的空值转换为空字符串,ASP.NET将它们解释为null.所以问题是从Angular 1.6($HttpParamSerializerProvider)调用WebAPI
Upd3:我知道解决方法,但我没有要求它们.我想要一个特定问题的解决方案:
null值List<int?>因为API文档是自动生成的,我不希望将文本数组视为参数类型JQuery.param …我想舍入一个数字,我需要一个正确的整数,因为我想将它用作数组键.想到的第一个"解决方案"是:
$key = (int)round($number)
Run Code Online (Sandbox Code Playgroud)
但是,我不确定这是否会一直有效.据我所知(int)只是截断任何小数,因为round($number)返回一个理论上有限精度的浮点数,是否有可能round($number)返回类似7.999999 ...然后$key是7而不是8?
如果这个问题确实存在(我不知道如何测试它),它怎么能解决?也许:
$key = (int)(round($number) + 0.0000000000000000001) // number of zeros chosen arbitrarily
Run Code Online (Sandbox Code Playgroud)
有没有比这更好的解决方案?
我想统一我的网站的导航布局,所以我创建了一个单独的html文件,其中包含导航的代码.我使用JS动态加载文件:
$("#navigation").load("/navigation/navigation.html", function() {
$.getScript('/material.min.js');
});
Run Code Online (Sandbox Code Playgroud)
问题是没有为这个html中的动态加载组件执行material.min.js,我失去了一些关键功能.我该如何解决这个问题?
angular ×4
javascript ×4
firefox ×2
angular-cli ×1
asp.net ×1
bookmarks ×1
browser ×1
command ×1
css ×1
favicon ×1
html ×1
integer ×1
jquery ×1
page-refresh ×1
php ×1
protractor ×1
query-string ×1
rounding ×1
xcode ×1