我试图在我的app.component.ts文件中创建以下HTML元素:
<a *ngFor="let ver of versionList">{{ver}}</a>
我遇到的问题是将*ngFor添加到元素中。我试过用:
const a = this.renderer.createElement('a');
this.renderer.setProperty(a, '*ngFor', 'let ver of versionList');
和
const a = this.renderer.createEl
我有一个等级产品。我想要创建一个列名与类字段名相同的表。
product.ts
export class Product{
public id:number;
public name:string;
}
product.component.html
<th *ngFor="let column of columns">
<tr>
{{column}}
</tr>
product.component.ts public columns = [];
我使用mat-select material和Angular5。我陷入了无法将值绑定到mat-select中的*ngfor的问题中。
这些值是从rest API响应中获取的,我将其赋值给mat select中分配给ngfor的值。当我对其进行控制台操作时,我可以看到这些值,但是在html中,我无法获得该值。
html
<mat-select name="name" [(ngModel)]="nameselected">
<mat-optgroup *ngFor="let name of names" [label]="n
我有html表,我正在绑定来自该表中的数组的数据。我正在更改数组中的一些值,但我的更改没有在表中得到反映。数据没有正确绑定。我该如何解决这个问题。
Html代码-
<tr *ngFor="let process of processToShow; let i = index">
<td>{{ process.processName}}</td>
<td >
{{ process.processStatus }}
</td>
</tr>
我在ts文件中有一个数组,类似于:
processToShow: A
我正在尝试构建一个包含大量数据的表,其中一些数据我希望在单击特定行后以模式显示。我创建了一个组件模式,它应该显示更多的数据,但问题是,当我单击特定的行时,它会将我带到另一个页面,我希望将其显示为模式,而不是在新页面中。 这是我的html <tr *ngFor="let data of listOfUsers" routerLink="/sidebarComp">
<td>{{data.Name}}</td>
<td>{{data.ID}}
下面是我想要使用ngFor显示数据表中的数据时的错误屏幕截图:
This code for Angular html component. I try to insert data into the datatables from typescript. Currently i get the data trough api and i want to insert the data into the datatable by using ngFor but it not working as in image attach.
<tbody>
<tr *n
我目前在一个项目中工作,这需要我填充一个动态数量的按钮与浸泡的链接,以打开它们。 <tr *ngFor="let competence of competences; let i = index">{{competence.name.de}}
<td *ngFor="let competenceLevel of levels; let j = index">
<button type="button" *ngFor="let learnRecommendation of getLearnReco
我已经创建了一个HTML-表格的角度。行将像
<tr mdbTableCol *ngFor="let el of filteredElements;">
<td align="right">{{el.totalExpenses | number : '.2-2'}}</td>
当我刷新数组filteredElements中的元素时,视图不会更新。下面是我刷新Array的代码:
this.filteredElements[this.filteredElements.findIndex(el => e
我有以下模板:
<div *ngFor="let item of myArray | customPipe1 | customPipe2; let l = length">
Here is the length of my ngFor : {{l}}
</div>
不幸的是,在ngFor中不存在长度。如何解决这个问题,使ngFor中的长度可用?