小编Arm*_*ots的帖子

Angular 2:无法绑定到x,因为它不是已知的本机属性

在Angular 2组件中我有 authbox.component.ts

import {Component} from 'angular2/core';
import {COMMON_DIRECTIVES} from 'angular2/common';
import {Credentials} from './credentials'
@Component({
    selector: 'authbox',
    template: `<div>
       <div class="login-panel" *NgIf="!IsLogged">
            <input type="text" *NgModel="credentials.name" />
            <input type="password" *NgModel="credentials.password" />
            <button type="button" (click)="signIn(credentials)">?| Sign In</button>
        </div>
        <div class="logged-panel" *NgIf="IsLogged">
            <span>{nickname}</span>&nbsp;&nbsp; <button type="button" (click)="signOut()">|? Sign out</button>
        </div>
    </div>`,
    directives: [COMMON_DIRECTIVES]
})


export class AuthBoxComponent {

    private _isLogged: boolean;

    get IsLogged(): boolean {
        return this._isLogged
    }
    set IsLogged(value: boolean) {
        this._isLogged = value;
    }

    public credentials: Credentials;

}
Run Code Online (Sandbox Code Playgroud)

在浏览器中我遇到错误« 无法绑定到'NgModel',因为它不是已知的本机属性 »和« …

angular2-template angular

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

使用TS开发Angular2但没有NPM

所有指南都建议安装npm,但我正在寻找一种没有它的方法.

有Angular2文件可用,但它们都不是TypeScript代码.

那我该怎么办?我需要Angular2.ts或具体Angular2-xx.js.d.ts文件?

更新:我已经下载Angular2NPM,并得到完整的源代码树,其中很难找到具体的东西.搜索.d.ts对于Angular2没有返回结果.很多.ts.d.ts文件都在庞大的代码集合中.

javascript npm typescript angular

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

我可以在界面中使用Activator.CreateInstance吗?

我有一个例子:

        Assembly asm = Assembly.Load("ClassLibrary1");
        Type ob = asm.GetType("ClassLibrary1.UserControl1");
        UserControl uc = (UserControl)Activator.CreateInstance(ob);
        grd.Children.Add(uc);
Run Code Online (Sandbox Code Playgroud)

我正在创建一个类的实例,但是如何创建实现某个接口的类的实例?即UserControl1实现ILoad接口.

U:我可以稍后将对象转换为接口,但我不知道程序集中的哪个类型实现了接口.

.net c# reflection activator .net-assembly

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

从桌面应用获取Windows 8当前的强调色

我想获得用户指定的地铁颜色,只是为了自动适应桌面应用程序到主要的地铁风格.有办法吗?

c# windows-8

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

如何使用自定义控件扩展Windows 8 Explorer功能区?

例如,我想制作简单的缩放器,您可以在其中选择资源管理器中的图像并设置新的尺寸.

c# explorer extend windows-8

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

将字段与值进行比较并返回bool

我正在尝试将哈希从服务器应用程序移动到PostgreSQL.换句话说,我需要调用PGSQL的查询,它将查询中的字符串与字段中的字符串进行比较,并将相等比较的结果返回为bool,但我不知道如何在没有清除SQL的过程的情况下执行此操作.

upd:我有表用户的字段密码(目前是文本,将来 - bytea).我想写一些像

select * from values ('WrittenPassword' = users.password) where username = 'someuser' ,
Run Code Online (Sandbox Code Playgroud)

必须返回true或false作为平等比较的结果.

sql postgresql npgsql

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

C#.First()vs [0]

有兴趣,方法有什么不同.
所以,我创建了两个片段.

Snippet A 
List<int> a = new List<int>();
a.Add(4);
a.Add(6);
int b = a.First(); 
Run Code Online (Sandbox Code Playgroud)

Snippet B 
List<int> a = new List<int>();
a.Add(4);
a.Add(6);
int b = a[0]; 
Run Code Online (Sandbox Code Playgroud)

在IL,我们相信,所以

Snippet A IL
IL_0000:  nop         
IL_0001:  newobj      System.Collections.Generic.List<System.Int32>..ctor
IL_0006:  stloc.0     // a
IL_0007:  ldloc.0     // a
IL_0008:  ldc.i4.4    
IL_0009:  callvirt    System.Collections.Generic.List<System.Int32>.Add
IL_000E:  nop         
IL_000F:  ldloc.0     // a
IL_0010:  ldc.i4.6    
IL_0011:  callvirt    System.Collections.Generic.List<System.Int32>.Add
IL_0016:  nop         
IL_0017:  ldloc.0     // a
IL_0018:  call        System.Linq.Enumerable.First
IL_001D:  stloc.1     // b
IL_001E:  ret        
Run Code Online (Sandbox Code Playgroud)

Snippet B …
Run Code Online (Sandbox Code Playgroud)

c# linq collections performance

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

IIS URL-重写:HTTP到HTTPS

我有一些网站example.org,关于这一点我保留子网站像example.com/project1example.com/project2等.我只需要HTTP?HTTPS对某些子网站进行简单的重定向,但不想手动将其写入代码文件中.

所以我URL-Rewrite2为他找到了模块和规则:

<rewrite>
        <rules>
          <rule name="Redirect to HTTPS" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
              <add input="{HTTPS}" pattern="^OFF$" />
            </conditions>
            <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
          </rule>
        </rules>
      </rewrite> 
Run Code Online (Sandbox Code Playgroud)

它最多只有一个问题:它重定向http://example.com/project1https://example.com/,所以它丢失了子网站的URL部分和任何args.

如何解决这个问题?

UPD:使用此规则

    <rule name="Redirect to HTTPS" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="^OFF$" />
                        </conditions>
                        <action type="Redirect" url="https://{HTTP_HOST}{UNENCODED_URL}" />
</rule>
Run Code Online (Sandbox Code Playgroud)

子网站正常重定向,但参数是重复的.http://example.com/project1?page=2变成了https://example.com/project1?page=2&page=2.我做错了什么?

iis https url-rewriting url-routing url-rewrite-module

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

.NET Framework 4.5是否提供SSE4/AVX支持?

我想,我听说过,但不知道在哪里.

upd:我讲过JiT

.net simd avx .net-4.5 sse4

5
推荐指数
2
解决办法
2490
查看次数

Socket.Disconnect vs Socket.Close

使用袜子时,我必须遵循哪些区别和规则?我正在编写简单的守护进程,它必须侦听端口并执行某些操作.

c# sockets

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

VBA 中的“String$”是什么意思?

得到了奇怪的 Access 项目,在哪里找到了这一行:

strUserName = String$(39, 0)
Run Code Online (Sandbox Code Playgroud)

什么String$意思?

ms-access vba

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