小编can*_*sta的帖子

Angular 2:在不破坏它们的情况下在不同组件之间交换

我正在尝试使用Angular 2构建一个窗口管理器.基本上,我希望能够在窗口之间交换(这是在路由器插座中注入的组件)而不会丢失它们的状态.例如,当我更改为客户列表时,我正在编辑产品信息表单,然后我回到产品表单,我发现它处于相同状态......是否可能?

angular

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

SignalR配置HubConnection

我正在使用Asp.Net SignalR 2.

在.net客户端(我使用的是Microsoft.AspNet.SignalR.Client)中,是否需要部署HubConnection?

我尝试过这样做,但需要花费太多时间......

.net asp.net dispose signalr.client signalr-2

9
推荐指数
1
解决办法
5006
查看次数

在Angular 2的构造函数中注入了Router的故障单元测试服务

我正在尝试测试在其构造函数中注入应用程序路由器的服务.继Julie Ralph在AngularConnect conf 2015(以及她的存储库:https://github.com/juliemr/ng2-test-seed)中提出的建议后,我正在使用Karma和Jasmine.

它遵循要测试的示例服务:

import { Router } from 'angular2/router';

export class ExampleService {
  constructor(router : Router) {
    this._router = router;
  }

  //...
}
Run Code Online (Sandbox Code Playgroud)

现在,我只是断言真相.它遵循服务测试:

import { it, describe, expect, inject, beforeEachProviders, MockApplicationRef } from 'angular2/testing';
import { ROUTER_PROVIDERS } from 'angular2/router';
import { provide, ApplicationRef } from 'angular2/core';

import { ExampleService } from 'example-service.js';

describe('ExampleService', () => {
  beforeEachProviders(() => [
    ROUTER_PROVIDERS, ExampleService,
    provide(ApplicationRef, { useClass: MockApplicationRef })
  ]);

  it('should validate the truth', inject([ExampleService], …
Run Code Online (Sandbox Code Playgroud)

testing unit-testing karma-runner angular

7
推荐指数
1
解决办法
4116
查看次数

Angular 2:无法访问http请求中的响应标头

我正在使用angular2-http(alpha.44)模块从REST Api检索数据.我无法弄清楚如何访问响应的标题映射中的信息,我需要一个特定的字段.例:

var req = new Request({
  url: `localhost/api/products`,
  method: RequestMethods.Get
});

this.http.request(req).subscribe(
  res => {
    // Can't access the headers of the response here.... res.headers is empty
    },
  error => { ... },
  _ => {}
);
Run Code Online (Sandbox Code Playgroud)

奇怪的是,如果我在浏览器的开发工具中检查网络流量,则会出现响应头...

angular

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

微软Asp.net Owin Helios项目还活着吗?

一年前,微软宣布了"helios"项目(http://blogs.msdn.com/b/webdev/archive/2014/02/18/introducing-asp-net-project-helios.aspx).从那时起,它的nuget包没有更新,也没有相关新闻.开始使用它是否安全还是死了?

asp.net helios owin katana

5
推荐指数
1
解决办法
1192
查看次数

测试 - 间歇性错误:'失败:选择器"#root0"与任何元素都不匹配

我正在使用Angular2 beta版本构建一个应用程序,当我运行我的测试用例时,我随机得到错误:

选择器"#root0"与任何元素的错误都不匹配.

测试代码:

@Component({
  template: '',
  directives: [GroupBox, GroupBoxHeader]
})
class TestComponent {
}

describe('group-box control', () => {

  it('should show the title', injectAsync([TestComponentBuilder], (tcb) => {
    return tcb.overrideTemplate(TestComponent, '<group-box><group-box-header>Title Content</group-box-header></group-box>')
      .createAsync(TestComponent).then( (fixture) => {
        fixture.detectChanges();
        let compiled = fixture.debugElement.nativeElement;
        expect(compiled).toContainText('Title Content');
    });
  }));

  it('should show the body', injectAsync([TestComponentBuilder], (tcb) => {
    return tcb.overrideTemplate(TestComponent, '<group-box><group-box-header>Title Content</group-box-header>Body Content</group-box>')
      .createAsync(TestComponent).then( (fixture) => {
        fixture.detectChanges();
        let compiled = fixture.debugElement.nativeElement;
        expect(compiled).toContainText('Body Content');
    });
  }));
});
Run Code Online (Sandbox Code Playgroud)

我使用Karma和Jasmine,遵循https://github.com/juliemr/ng2-test-seed的指导方针

以下存储库重现错误:https://github.com/cangosta/ng2_testing_controls

堆栈跟踪: …

testing jasmine karma-runner angular

5
推荐指数
1
解决办法
410
查看次数