For your specific issue...
{{(item.meta | async)?.stockPrice}}
use the elvis operator (?
) to make sure the async
operation is complete and then access the desired value
source code here in github: https://github.com/aaronksaunders/afwithngcli
--
you got ahead of me... working on the new blog post, but here is the code
script.html
</ion-card>
<ion-card *ngFor="#user of usersWithMessages | async">
<ion-card-header>
{{user.displayName}}
</ion-card-header>
<ion-card-content>
{{ (user.messages | async) | json}}
</ion-card-content>
</ion-card>
script.ts
this.usersWithMessages = this.af.list('/users').map((_users) => {
return _users.map((_user) => {
_user.messages = this.af.object("/userObjects/public-messages/" +_user.$key)
return _user
})
})
data
"userObjects" : {
"public-messages" : {
"8d75a63e-80cd-40cc-8f8b-87d3d33b0cd0" : {
"message-id-0" : {
"text" : "a public message"
}
},
"9c6ea912-ec24-4127-b123-6512ed135f06" : {
"-KFCGp5ojo7JSX2myOPE" : {
"date" : "1460511658442.75",
"text" : "this should be a. public message"
},
"-KFCJc4GtEo_PDWi7hru" : {
"date" : "1460512391529.69",
"text" : "this is a message that should be public"
},
"message-id-100" : {
"date" : "3243245411111",
"text" : "public for the other user"
}
}
}
},
"users" : {
"8d75a63e-80cd-40cc-8f8b-87d3d33b0cd0" : {
"displayName" : "c@mail.com",
"provider" : "password"
},
"9c6ea912-ec24-4127-b123-6512ed135f06" : {
"displayName" : "b@mail.com",
"provider" : "password"
},
"cdcf32af-a8cd-467d-a04f-dfc223e890d2" : {
"avatar" : "https://secure.gravatar.com/avatar/d23563ab3014ce965a90c37b22a34da8?d=retro",
"displayName" : "bryce@mail.com",
"provider" : 4
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…