嘿,我在商店中有对象,我想在模板中查看该对象。 我的Ts文件: import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { Comment } from '../../models/comment.model';
import { User } from '../../models/user.model';
im
我想迭代一个嵌套的map,以便从第二个map中的列表中获得值。 映射: public groupedItemMap: Map<string, Map<string, ItemSearchResult[]>>; 地图结构: Map
--[[Entries]]
----0
-------key - number (if occured once or is duplicate)
-------value - Map
---------[[Entries]]
-----------key - itemNumber
-----------value - List of obj
是否有一种方法可以从字符串中合成类型记录中对象的键值?下面是一个例子:
object[index].key=value
应该是,
object[index].["String".array[i]]=value
以下内容不起作用:
{{ object[index].{{"string".concat(Variable[index])}} }} <-- the rendering is perfectly fine but the execution is missing
我试图在两个"ngFor“循环中读取一个对象,第一个循环充当数组的计数器,该数组
我正在尝试遍历模板中的FormGroup of FormControls。我想为每个人显示一个复选框。这就是我的component.ts的样子
tags = ["vegan","vegetarian","meat","fruit","vegetable","seafood","fish","nut"];
get tagsForForm() {
return this.foodForm.get('tags') as FormGroup;
}
我希望迭代对象中的键值对,并在每一行中显示两项。我看了其他的例子,比如这个,但是我不知道如何为它添加键值。
这是我的代码:
<div *ngFor="let item of book.bookData.privateData | keyvalue; index as i; let even = even">
<div fxFlex="100" fxLayout="row" *ngIf="even">
<div fxFlex="50" fxLayout="