所以,我有两节课
Item { name: string; desc: string; meta: string}
ViewItem { name: string; desc: string; hidden: boolean; }
Run Code Online (Sandbox Code Playgroud)
我有一个Item数组需要转换为ViewItem数组.目前,我使用for循环遍历数组,实例化ViewItem,为属性赋值并将其推送到第二个数组.
有没有一种简单的方法来实现这个使用lambda表达式?(类似于C#)或者还有其他方法吗?
我有一个可满足的div,看起来像这样:
<div class="wall-title col-sm-12"
[attr.contenteditable]="wall.title && wall.title !== 'Favorites'"
(blur)="wallNameChanged($event.target.outerText)"
(keyup.enter)="wallNameChanged($event.target.outerText)">
{{wall.title}}
</div>
Run Code Online (Sandbox Code Playgroud)
当用户在编辑div内容后按Enter键时,我想模糊div.目前,正在添加新行字符,并且在UI中可以看到新行.
我该如何实现这一目标?
我正在使用此插件中的click-outside指令 - > http://embed.plnkr.co/v7BMUv/
我的TS编译器抛出以下错误:
TS2322:类型'订阅'不能分配给'Observable'类型."订阅"类型中缺少"_isScalar"属性.
TS2339属性'unsubscribe'在'Observable'类型中不存在.
我的tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"suppressImplicitAnyIndexErrors": true,
"noImplicitAny": false,
"noEmitOnError": false
},
"exclude": [
"node_modules",
"wwwroot"
]
}Run Code Online (Sandbox Code Playgroud)
代码导致错误:
ngOnInit() {
this.globalClick = Observable
.fromEvent(document, 'click')
.delay(1)
.do(() => {
this.listening = true;
}).subscribe((event:MouseEvent) => {
this.onGlobalClick(event);
});
}
Run Code Online (Sandbox Code Playgroud)
我该如何克服这个错误?
我有一个角色的应用程序.我需要在表格中显示数据列表.我已经在表的TR元素上应用了ngFor.但是,当展开每一行时,必须显示另一行以及有关该项目的其他详细信息.
码:
<table>
<thead>
<tr>Header here</tr>
</thead>
<tbody>
<tr *ngFor="let item of results">
+ Collapsed Row
<!-- How do I display the expanded row and display additional details when + symbol is clicked? -->
</tr>
</tbody>
</table>Run Code Online (Sandbox Code Playgroud)
angular ×3
typescript ×2
arrays ×1
blur ×1
expand ×1
html ×1
html-table ×1
javascript ×1
mouseevent ×1
ngfor ×1
observable ×1
rxjs ×1