小编Mis*_*lis的帖子

失败:超时等待异步Angular任务在11秒后完成

我想使用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架构.我不知道是否有链接.

实际上,我根本不知道如何解决这个问题.

有人可以帮帮忙吗?

javascript protractor angular

17
推荐指数
2
解决办法
9308
查看次数

ng弹出的目的是什么?

该主题的文档非常简短:

ng eject 弹出您的应用程序并输出正确的webpack配置和脚本

这个命令的目的是什么?

command angular-cli angular

16
推荐指数
2
解决办法
8021
查看次数

在书签中刷新favicon(Firefox)

几天前,我已经更改了我网站的图标:当我展示网站时效果很好:在此输入图像描述


我的网站也有书签,但它显示了旧的图标: 在此输入图像描述

我已经看过这里,但答案并没有解决我的问题.解决方案可能非常简单,但到目前为止我还没有找到任何结果.

谢谢!

browser favicon firefox bookmarks page-refresh

15
推荐指数
4
解决办法
2万
查看次数

使用图像而不是Bootstrap的glyphicon

我想在一个没有填充底部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 …

css responsive-design twitter-bootstrap twitter-bootstrap-3

15
推荐指数
2
解决办法
2万
查看次数

angular2在一个元素上不能有多个模板绑定

我有这个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)

javascript angular

15
推荐指数
1
解决办法
1万
查看次数

在Xcode 4中添加外部可执行文件

我想在OS X上调试Firefox代码.我正在阅读这个页面,它告诉我:

现在您需要添加可执行文件.选择Project> New Custom Executable并键入一个漂亮的名称,然后单击Choose按钮找到要调试的.app文件(Mozilla.app,Firefox.app,DeerParkDebug.app等)..app文件是

但是使用xcode 4没有Projects菜单.我似乎无法找到如何添加自定义可执行文件.我已成功构建Firefox但我无法调试它,因为我不知道如何在Xcode 4中添加可执行文件.我怀疑链接中的步骤是针对Xcode 3的.

firefox xcode

14
推荐指数
1
解决办法
4545
查看次数

Angular 2 - 使用"升级适配器"升级时是否可以使用新路由器

我正在使用升级适配器逐步升级我的应用程序.我的应用程序使用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路由器吗?

谢谢

javascript angular-ui-router angular

14
推荐指数
1
解决办法
484
查看次数

如何使ASP.NET停止将null解释为字符串

我有一个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:我知道解决方法,但我没有要求它们.我想要一个特定问题的解决方案:

  • 这是一种GET方法
  • 方法接受来自Uri的列表
  • 列表可以包含null
  • 这应该是List<int?>因为API文档是自动生成的,我不希望将文本数组视为参数类型
  • 默认情况下,ASP.NET期望空字符串为空值(JQuery.param …

asp.net query-string asp.net-web-api

13
推荐指数
2
解决办法
695
查看次数

PHP舍入到整数

我想舍入一个数字,我需要一个正确的整数,因为我想将它用作数组键.想到的第一个"解决方案"是:

$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)

有没有比这更好的解决方案?

php floating-point integer rounding

12
推荐指数
2
解决办法
1万
查看次数

Material Design Lite JS不适用于动态加载的html文件

我想统一我的网站的导航布局,所以我创建了一个单独的html文件,其中包含导航的代码.我使用JS动态加载文件:

$("#navigation").load("/navigation/navigation.html", function() {
   $.getScript('/material.min.js');
});
Run Code Online (Sandbox Code Playgroud)

问题是没有为这个html中的动态加载组件执行material.min.js,我失去了一些关键功能.我该如何解决这个问题?

html javascript jquery material-design-lite

11
推荐指数
2
解决办法
5354
查看次数