Binding to list of users
Showing a list of users in Skylight
BindingUsersRecipe.zip
3KB
Binary
Binding Users Recipe Application Bundle
This recipe includes two views that are accessible from the root view:
- The
allUsers
view has one card that is bound toskylight.local
and an adapter that returns the value ofawait skylight.getUsers()
. The card's text displays the user'susername
. - The
filteredUsers
view has one card that is bound toskylight.local
and an adapter that filters the list of all users for users that have both thefirstName
andlastName
properties, then maps each user to a new object that has aname
property. The card's text displays this mapped object'sname
value.
skylight.local
is an arbitrary context for these cards. In the adapter script, we ignore the context's value (which is stored in event.data
) and work with await skylight.getUsers()
instead.Last modified 2yr ago