小编Ben*_*rth的帖子

Angular 2 - 组件内部的formControlName

我想创建一个可以与FormBuilder API一起使用的自定义输入组件.如何formControlName在组件内添加?

模板:

<label class="custom-input__label"
          *ngIf="label">
        {{ label }}
</label>
<input class="custom-input__input" 
       placeholder="{{ placeholder }}"
       name="title" />
<span class="custom-input__message" 
      *ngIf="message">
        {{ message }}
</span>
Run Code Online (Sandbox Code Playgroud)

零件:

import {
    Component,
    Input,
    ViewEncapsulation
} from '@angular/core';

@Component({
    moduleId: module.id,
    selector: 'custom-input',
    host: {
        '[class.custom-input]': 'true'
    },
    templateUrl: 'input.component.html',
    styleUrls: ['input.component.css'],
    encapsulation: ViewEncapsulation.None,
})
export class InputComponent {
    @Input() label: string;
    @Input() message: string;
    @Input() placeholder: string;
}
Run Code Online (Sandbox Code Playgroud)

用法:

<custom-input label="Title" 
           formControlName="title" // Pass this to input inside the component>
</custom-input>
Run Code Online (Sandbox Code Playgroud)

angular2-forms angular

29
推荐指数
3
解决办法
3万
查看次数

如何在Angular 2中跟踪路由?

我有分离文件路由设置的组件:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { Route } from '../core/route.service';
import { extract } from '../core/i18n.service';
import {CalendarThematicPlanComponent} from './calendar-thematic-plan.component';

const routes: Routes = Route.withShell([
  { path: 'calendar', component: CalendarThematicPlanComponent }
]);

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: []
})

export class CalendarThematicPlanRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

当我输入URL地址时:http://localhost:4200/calendar我被重定向到主页.

如何在Angular 2中跟踪路由?

angular-routing angular

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

使用Django的collectstatic与boto S3一段时间后抛出"错误32:破管"

我正在使用boto和S3存储我的Django站点的静态文件.当使用该collectstatic命令时,它会在停止文件并投掷之前完美地上传大量文件."Error 32: Broken Pipe."当我尝试再次运行该命令时,它会跳过它已经上传的文件并从它停止的文件开始,之前没有上传任何新内容就抛出相同的错误.

python django amazon-s3 boto collectstatic

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

由于"未知消息摘要算法",Curl无法访问github.com

我一直在尝试整天安装RVM,而且我一直都被curl挂断了,因为curl拒绝连接到https://github.com.

这是我当前的错误: curl: (35) error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm

这是我使用verbose标志时的日志输出:

* About to connect() to github.com port 443 (#0)
*   Trying 192.30.252.130...
* Adding handle: conn: 0x100805400
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x100805400) send_pipe: 1, recv_pipe: 0
* Connected to github.com (192.30.252.130) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /System/Library/OpenSSL/certs/cacert.pem
    CApath: none
* SSLv3, TLS handshake, Client hello (1):
* …
Run Code Online (Sandbox Code Playgroud)

macos ssl curl openssl osx-mavericks

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

使用phantomjs进行Windows身份验证

我正在研究phantomjs作为我最新项目中UI自动化的可能解决方案,但我似乎无法让Windows身份验证正常工作.我已经尝试设置page.settings.userNamepage.settings.password,但低于总的片段得到一个401和底层堆栈没有努力解决这个问题.我的搜索失败了,所以我来到社区寻求帮助.

var page = require('webpage').create();

page.onResourceReceived = function(response) {
    phantom.exit(response.status);
};

page.open('http://bing.com');
Run Code Online (Sandbox Code Playgroud)

c# windows-authentication phantomjs

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

从 Dotnet Core 访问 IIS 虚拟目录

我正在构建一个 Dotnet Core Web 应用程序,它需要允许经过 Windows 身份验证的用户浏览连接的虚拟目录并查看和选择托​​管在那里的文件。

Dotnet Core 应用程序是否可以访问虚拟目录?除此之外,有没有办法让普通的 Dotnet 应用程序做到这一点?

iis .net-core asp.net-core

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