I have a document in the firestore. Users with roles in object form:
ktwmsjEnRxaVja8RFdSBAwSE7yi2
uid: 'ktwmsjEnRxaVja8RFdSBAwSE7yi2',
username: 'some user',
**roles:
admin: false,
user: true,
dealer: false**
updatedAt: 3938y349'
When I do an *ngFor="let user of users | async
, I can get the user info on template with user.name
. All good.
But how do I display on the user card their different roles?
if user has a role of user, admin
, I want to display that on the template. Do I do another *ngFor on the user.roles
?
I want to display all true
roles.
如果角色不是集合,则无需使用 * ngFor
您可以简单地在模板中使用插值语法,如下所示
{{user.roles.admin}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.