我的简化目标是构建一个包含项目模板的列表组件.例如:
<list>item</list>
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
import {bootstrap} from 'angular2/platform/browser';
import {Component} from 'angular2/core';
@Component({
selector: 'list',
template: `
<ul>
<li *ngFor="let i of items" >
<ng-content></ng-content>
</li>
</ul>
`
})
class List {
items = [1, 2, 3];
}
@Component({
selector: 'app',
directives: [List],
template: '<list>item</list>'
})
class App { }
bootstrap(App, []);
Run Code Online (Sandbox Code Playgroud)
预期结果:
实际结果:
•
•
•项目
我的应用程序正在从标准输入读取:
var input = process.stdin.read();
Run Code Online (Sandbox Code Playgroud)
是否可以将 Visual Studio Code 配置为在调试时重定向输入?
所以它等于这个命令行:
node app.js < input.txt
Run Code Online (Sandbox Code Playgroud)
此配置不起作用,并且调试未启动。
{
"name": "Launch",
"type": "node",
"program": "app.js",
"stopOnEntry": false,
"args": [
"<",
"input.txt"
]
}
Run Code Online (Sandbox Code Playgroud) 众所周知,Angular2没有ng-init或其他东西.所以,如果我们尝试做类似的事情:
<div #rr="2+2">
{{rr}}
</div>
Run Code Online (Sandbox Code Playgroud)
我们将得到运行时错误:
Error: There is no directive with "exportAs" set to "2+2"
我正在观看youtube上的一个Angular2开发视频,并看到了完全相同的构造.这是截图:

如何分配用户模板变量?
我正在C#上编写DirectShow过滤器,但我不想使用任何第三方库。基于正确的COM接口原型(例如IGraphBuilder,IBaseFilter,IPin等),此任务几乎是100%。如果接口的原型不正确,则会在托管/本机边界引发各种异常。问题在于确定错误原型接口方法的位置。
当前,我有:DirectShow.dll中发生了'System.NullReferenceException'类型的异常(这是我的托管dll的名称),并且在托管/本地边界之前未进行处理
调用堆栈:
ntdll.dll!NtWaitForSingleObject()+ 0xa字节
KernelBase.dll!WaitForSingleObjectEx()+ 0x9c字节
clr.dll!CLREvent :: WaitEx()+ 0x20f字节
clr.dll!CLREvent :: WaitEx()+ 0x1b8字节
clr.dll CLREvent :: WaitEx()+ 0x73字节
clr.dll!Thread :: WaitSuspendEventsHelper()+ 0xcf字节clr.dll!Thread :: WaitSuspendEvents()+ 0x10字节
clr.dll!string“ d:\ iso_whid \ amd64fre \ base \ ntos \ r“ ...()+ 0x35688d字节
clr.dll!Thread :: RareDisablePreemptiveGC()+ 0x118字节
clr.dll!GCHolderEEInterface <0,0,0> :: ~~ GCHolderEEInterface <0,0,0>() + 0x19字节clr.dll!Debugger :: SendCatchHandlerFound()+ 0x150字节
clr.dll!string“ d:\ iso_whid \ amd64fre \ base \ ntos \ r” ...()+ 0x3b9340字节
clr.dll!NotifyOfCHFFilterWrapper()+ 0x77字节
clr.dll!string“ d:\ iso_whid \ amd64fre \ base \ ntos \ …
由于某种原因DuplicateOutput1失败的地方DuplicateOutput没有。
#include <D3D11.h>
#include <DXGI1_5.h>
int main() {
ID3D11Device *device;
D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1 };
D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, levels, ARRAYSIZE(levels), D3D11_SDK_VERSION, &device, NULL, NULL);
IDXGIDevice *dxDevice;
device->QueryInterface<IDXGIDevice>(&dxDevice);
IDXGIAdapter *adapter;
dxDevice->GetAdapter(&adapter);
IDXGIOutput *output;
adapter->EnumOutputs(0, &output);
IDXGIOutput5 *output5;
output->QueryInterface<IDXGIOutput5>(&output5);
IDXGIOutputDuplication *outputDuplication;
auto hr1 = output5->DuplicateOutput(device, &outputDuplication);
Run Code Online (Sandbox Code Playgroud)
这里是 S_OK
const DXGI_FORMAT formats[] = { DXGI_FORMAT_B8G8R8A8_UNORM };
auto hr2 = output5->DuplicateOutput1(device, 0, ARRAYSIZE(formats), formats, &outputDuplication);
}
Run Code Online (Sandbox Code Playgroud)
0x887a0004:此系统不支持指定的设备接口或功能级别。
我的任务很简单,我需要两个工人运行。
var taskNum = 0;
function Task() {
var me = this;
this.name = '#' + ++taskNum;
Task.prototype.run = function () {
console.log(me.name);
setTimeout(me.run, 1000);
}
}
var t1 = new Task();
t1.run();
var t2 = new Task();
t2.run();
Run Code Online (Sandbox Code Playgroud)
输出应该是 1,2,1,2,但它是: 1 2 1 2 2 2 2 2 2
这可以通过将“Task.prototype.run”更改为“this.run”来解决。但是可以通过不删除原型来解决这个问题吗,因为我在复杂的解决方案中需要它?
angular ×2
c# ×1
com ×1
debugging ×1
dxgi ×1
interop ×1
javascript ×1
marshalling ×1
node.js ×1
prototype ×1
settimeout ×1
this ×1
typescript ×1