在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> <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',因为它不是已知的本机属性 »和« …
所有指南都建议安装npm,但我正在寻找一种没有它的方法.
有Angular2文件可用,但它们都不是TypeScript代码.
那我该怎么办?我需要Angular2.ts或具体Angular2-xx.js和.d.ts文件?
更新:我已经下载Angular2过NPM,并得到完整的源代码树,其中很难找到具体的东西.搜索.d.ts对于Angular2没有返回结果.很多.ts和.d.ts文件都在庞大的代码集合中.
我有一个例子:
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:我可以稍后将对象转换为接口,但我不知道程序集中的哪个类型实现了接口.
例如,我想制作简单的缩放器,您可以在其中选择资源管理器中的图像并设置新的尺寸.
我正在尝试将哈希从服务器应用程序移动到PostgreSQL.换句话说,我需要调用PGSQL的查询,它将查询中的字符串与字段中的字符串进行比较,并将相等比较的结果返回为bool,但我不知道如何在没有清除SQL的过程的情况下执行此操作.
upd:我有表用户的字段密码(目前是文本,将来 - bytea).我想写一些像
select * from values ('WrittenPassword' = users.password) where username = 'someuser' ,
Run Code Online (Sandbox Code Playgroud)
必须返回true或false作为平等比较的结果.
有兴趣,方法有什么不同.
所以,我创建了两个片段.
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) 我有一些网站example.org,关于这一点我保留子网站像example.com/project1和example.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/project1到https://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.我做错了什么?
我想,我听说过,但不知道在哪里.
upd:我讲过JiT
使用袜子时,我必须遵循哪些区别和规则?我正在编写简单的守护进程,它必须侦听端口并执行某些操作.
得到了奇怪的 Access 项目,在哪里找到了这一行:
strUserName = String$(39, 0)
Run Code Online (Sandbox Code Playgroud)
什么String$意思?
c# ×5
.net ×2
angular ×2
windows-8 ×2
.net-4.5 ×1
activator ×1
avx ×1
collections ×1
explorer ×1
extend ×1
https ×1
iis ×1
javascript ×1
linq ×1
ms-access ×1
npgsql ×1
npm ×1
performance ×1
postgresql ×1
reflection ×1
simd ×1
sockets ×1
sql ×1
sse4 ×1
typescript ×1
url-routing ×1
vba ×1