*ngFor 之后发生了什么?
What is hapenning after *ngFor?
我对 Angular2 有点陌生。
GetYapiBelge() {
var filterInfos = new Array<FilterInfo>();
filterInfos.push(this.AddFilterInfo(General.Syscd, "SYSCD"));
filterInfos.push(this.AddFilterInfo(this.YapiBelgeTurId, "YPBLGTRID"));
this._ServiceIslemlerSvc.GetYapiBelgeBasvuruByFilter(filterInfos).subscribe((result) => this.GetYapiBelgeBasvuruByFilterCompleted(result));
}
GetYapiBelgeBasvuruByFilterCompleted(result: any)
{
this._ActiveYapiBelgeBasvuruBec = result;
$('#dtYapiBelge').DataTable();
$('.collapse')
.on('shown.bs.collapse', function () {
$(this)
.parent()
.find(".fa-plus")
.removeClass("fa-plus")
.addClass("fa-minus");
})
.on('hidden.bs.collapse', function () {
$(this)
.parent()
.find(".fa-minus")
.removeClass("fa-minus")
.addClass("fa-plus");
});
}
js 代码是关于我 grid.I 找到一些库并使用它的。
当我添加所有 clomns 的项目时它正在工作 hardway.But 我通过我的服务获得它们它不起作用。
当我第一次调试它时,我可以看到 js 代码对我的网格的影响,但是在得到项目之后它是 gone.I 我在我的 HTML 端使用 ngFor 我想我需要一些东西js 代码在 ngFor 完成或类似的东西后触发。
有什么想法吗?
确保您在 HTML 中使用正确的 ngFor 格式,没有其他指令绑定到同一元素,并且您是变量迭代是一个数组。
<ul>
<li *ngFor="let word of dictionary">
{{word}}
</li>
</ul>
您不需要 class 的函数来为 ngFor 做任何特别的事情。
*ngFor 保留一个布尔变量 'last' 来标识数据是否是最后一个。所以只需将该值分配给一个变量,如果它是真的就调用一个函数。检查以下代码行。这可能对你有帮助。
<ul>
<li *ngFor="let i of items; let last = last">{{last ? yourFunction() : ''}}</li>
</ul>
我对 Angular2 有点陌生。
GetYapiBelge() {
var filterInfos = new Array<FilterInfo>();
filterInfos.push(this.AddFilterInfo(General.Syscd, "SYSCD"));
filterInfos.push(this.AddFilterInfo(this.YapiBelgeTurId, "YPBLGTRID"));
this._ServiceIslemlerSvc.GetYapiBelgeBasvuruByFilter(filterInfos).subscribe((result) => this.GetYapiBelgeBasvuruByFilterCompleted(result));
}
GetYapiBelgeBasvuruByFilterCompleted(result: any)
{
this._ActiveYapiBelgeBasvuruBec = result;
$('#dtYapiBelge').DataTable();
$('.collapse')
.on('shown.bs.collapse', function () {
$(this)
.parent()
.find(".fa-plus")
.removeClass("fa-plus")
.addClass("fa-minus");
})
.on('hidden.bs.collapse', function () {
$(this)
.parent()
.find(".fa-minus")
.removeClass("fa-minus")
.addClass("fa-plus");
});
}
js 代码是关于我 grid.I 找到一些库并使用它的。 当我添加所有 clomns 的项目时它正在工作 hardway.But 我通过我的服务获得它们它不起作用。
当我第一次调试它时,我可以看到 js 代码对我的网格的影响,但是在得到项目之后它是 gone.I 我在我的 HTML 端使用 ngFor 我想我需要一些东西js 代码在 ngFor 完成或类似的东西后触发。
有什么想法吗?
确保您在 HTML 中使用正确的 ngFor 格式,没有其他指令绑定到同一元素,并且您是变量迭代是一个数组。
<ul>
<li *ngFor="let word of dictionary">
{{word}}
</li>
</ul>
您不需要 class 的函数来为 ngFor 做任何特别的事情。
*ngFor 保留一个布尔变量 'last' 来标识数据是否是最后一个。所以只需将该值分配给一个变量,如果它是真的就调用一个函数。检查以下代码行。这可能对你有帮助。
<ul>
<li *ngFor="let i of items; let last = last">{{last ? yourFunction() : ''}}</li>
</ul>