我有以下* ngFor循环,并且在循环内有另一个div,我在其中应用了需要对象参数的指令:
<div class="container" *ngFor="let item of items">
<div [directiveName]="{testParamKey: item.name}"></div>
</div>
它给我一个错误:“无法读取未定义的属性'名称'”。 我不知道如何使用for循环中的项目传递此参数?
先谢谢了。
答案 0 :(得分:1)
使用可选的运算符。 def crudmatic(request, themodel, url, goto_on_save=None, admin=None):
"""
GET:
presents an admin form but outside of the admin application.
POST:
validates, saves and relocates
or if there are errors then it presents the form again
Returns:
an HTTP response
using the admin options defined and registered for the admin site for this model.
optionally you may supply an Admin
Usage:
# in your view:
return crudmatic(request,YourModelClass,url)
crud = create replace update delete
this does create only. it was intended to support all stages.
see editmatic
"""
if not admin:
try:
admin = site._registry[themodel]
except KeyError:
admin = DefaultAdmin(themodel, site)
else:
admin = admin(themodel, site)
# some breakage in django
# there is supposed to be a root path set,
# but I'm not running an admin site here
# if hasattr(admin,'admin_site'):
admin.admin_site.root_path = "/admin/"
return admin.add_view(request, url)
=COUNTIF($A$1:$A1,A1)>COUNTIF($B:$B,A1)